⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 excaro.h

📁 caro program is written by VC++ and AI
💻 H
字号:
/****************************************************************************/
//
// ~~~~~~~~~~~~~~~~~~~~~~ ExCaro's Main Header ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//								ExCaro.h
//
//***************************************************************************/



#ifndef __EXCARO_H__
#define __EXCARO_H__

#define WINVER 0x0500
// Include
#include <myheader.h>
#include "resource.h"
#include <commctrl.h>

// Macro get expression of direct position of pMatrix from visual value : x, y
#define posBlock(X,Y) ( *(pMatrix + (X) + (Y)*setting.iBlock ) )
// Is point win ?
#define IsWin(iP,iB)	(iP) >= ( rule[setting.iRule ].iMinPoint ? rule[setting.iRule ].iMinPoint : (iP) ) && (iB) >= ( rule[setting.iRule ].iMinBlock ? rule[setting.iRule ].iMinBlock : (iB))

#define VERSION " 4.1"					// String of Version
#define APPNAME "Anitsoft ExCaro"		// Application Name

#define MAX_RULE 5			// Max rule ( max row of Rule ComboBox )
#define MAX_SKIN 5			// Max skin ( max row of Skin ComboBox )
#define MAX_BUTTON 5		// Max Button ( start ID of context button )
#define MAX_CBUTTON 5		// Max Context Button
#define MAX_PLAYER 2		// Max Player ( max row of Players ComboBox )
#define MAX_PLAYERNAME 6	// Max Player's Name ( limit text in Player's Name EditBox )
#define MAX_UNDO 50			// Max turn player can undo

#define ID_PLAY 1			// ID of Button Playing
#define ID_SETTING 2		// ID of Button Settings
#define ID_CREDIT 3			// ID of Button Credit
#define ID_STATUS 4			// ID of Status Bar ( Status - Static Control )
#define ID_TIMER 1			// ID of Timer

#define DEFAULT_STATUS ""	// Default Status show this text
#define COMPLAY	1			// If Player is Computer, player[i].fPlay = COMPLAY = 1
#define HUMPLAY	0			// If Player is Human, player[i].fPlay = HUMPLAY = 0
#define LANG_EN	0			// If Language is English, setting.fPlay = LANG_EN = 0
#define LANG_VI	1			// If Language is Vietnamese, setting.fPlay = LANG_VI = 1

#define YHEADER 90					// Length of Header
#define YFOOTER 30					// Length of Footer
#define XLEFT 150					// Length of Leftbar
#define XRIGHT 10					// Length of Rightbar
#define CR_CHILDBACK RGB(50,50,50)	// WndChild Background Color
#define CR_WNDMAIN RGB(155,155,155)	// WndMain Background Color
#define XBLOCK	25					// Length of Block

#define CTIME 10					// Amount of time call per second
#define SETTING_STEP 15				// Length of Step Scroll in Setting Mode
#define CREDIT_STEP 3				// Length of Step Scroll in Setting Mode
#define CBTN_PLAYING 5				// Number of Context Button in Playing Mode
#define CBTN_SETTING 1				// Number of Context Button in Setting Mode
#define CBTN_CREDIT 2				// Number of Context Button in Credit Mode

////////////////////////////////////////////////////////////////
// Struct

/******* Setting Struct *******/
struct WNDTYPE
{
	HWND hWnd;
	int left;
	int top;
	int right;
	int bottom;
	int xClient;
	int yClient;
};

/******* ExCaro Struct *******/
struct EC
{
	HINSTANCE hInst;			// hInstance of Application
	HBITMAP hBanner;			// Handle of Banner bitmap
	BITMAP bmBanner;			// bitmap Banner
	char iTab;					// Current Tab : ID_PLAY / ID_SETTING / ....
	char szAppDir[MAX_PATH];	// Full Directory of Application
	bool fChooseFile;			// In Choose File ( Save / Load ) ? TRUE - FALSE
	RECT rOldMain;				// Old Size of WndWain before Full Screen
	int siVSetting;				// Position of Vert Scroll Bar in Setting mode
	POINT pMouse;				// Position of mouse
	POINT pOld;					// Position of Mouse in past	
	int iIcon;					// Dialog Icon -> i of player call edit icon
	int iDrawMode;				// Dialog Icon -> Draw Mode : Brush / Eraser
	int iCreditPos;				// Position of first text on Credit Mode
	int iVodd;					// Half of The odd of Vertical Scroll < Playing Mode >
	int iHodd;					// Half of The odd of Horizontal Scroll < Playing Mode >
	bool fDrag;					// Is Dragging WndPlay ?
	POINT poDrag;				// Root point of dragging
};

/******* Setting Struct *******/
struct SETTING
{
	bool fWarning;					// Enable Warning ?
	bool fSound;					// Sound on ?
	bool fTime;						// Enable Time Limit ?
	int  iTime;						// How many time limit
	char iRule;						// What is current rule ? Vietnam Caro = 0 / Classic Caro = 1 / ...
	bool fMenu;						// Show menu ?
	bool fFullScreen;				// Full Screen ?
	char iBlock;					// How many blocks ?
	char iNormalBlock;				// Number of blocks in undefined blocks rule?
	char szSoundFile[MAX_PATH];		// Directory of Sound File
	char iOpacity;					// Opacity of Windows
	bool fGrip;						// Show grip in dialog Icon ? true / false
	char iLang;						// Language ? 0 = LANG_EN = English / 1 = LANG_VI = Vietnamese
};

/******* Rule Struct *******/
struct RULE
{
	char iMinPoint;		// Minimum point of own need for win
	char iMinBlock;		// Minimum block next-door of own need for win
	char iBlock;		// Number of Blocks must be set. = 0 ( custom ) : > 0 ( can't custom )
};

/******* Skin Struct *******/
struct SKIN
{
	COLORREF crBlockBorder;			// Block Border's Color
	COLORREF crBlock;				// Block's Color
	COLORREF crMouse;				// Mouse High Light's Color
	COLORREF crPColor[MAX_PLAYER];	// Player's Color
};

/******* Player Struct *******/
struct PLAYER
{
	char szName[MAX_PLAYERNAME];	// Player's Name
	bool fPlay;						// Player : 0 / Computer : 1
	int iDiff;						// Difficult : Easy : 0 / Normal : 1 / Hard : 2
};

/******* Player's Avatar Struct *******/
struct AVATAR
{
	bool fDot[24][24];				// a Dot of Avatar.
};

/******* Playing Struct *******/
struct PLAY
{
	char fWin;				// Win ? True - False
	int iPBar;				// Position of Highlight Circle -- Player Bar
	int iTimeLimit;			// Remain of time  limit
	unsigned int iTimePlay;	// Sum of time play in a match
	bool fWarning;			// Warning ? T/F
	int siVPlay;			// Position of Vert Scroll Bar in Playing mode
	int siHPlay;			// Position of Horz Scroll Bar in Playing mode
	unsigned int iChecked;	// Amount of checked block in playing table
	char iTurn;				// Current Turn ( 0 -> MAX_PLAYER -1 )
	POINT pSWin[4];			// Position of start point of WinLine
	POINT pEWin[4];			// Position of end point of WinLine
	int iWinner;			// Player is winner : 0 = Player 1 , 1 = Player 2,...
	bool fComPlay;			// Comuter is Playing ? T/F
	POINT pComPlay;			// Target of Computer
	int iUndo;				// Current Undo Pos
	int iMaxUndo;			// Max "Undo" touch before Undo -- Need for redo
	POINT pUndo[MAX_UNDO];	// Max turn you can undo
	bool fKey;				// Using keyboard ?
};

////////////////////////////////////////////////////////////////
// Extern Variable
extern WNDTYPE WndMain, WndChild, WndPlay, DlgSetting, DlgIcon, WndBtn[MAX_BUTTON], WndCredit;
extern SETTING setting;
extern RULE rule[MAX_RULE];
extern SKIN skin;
extern PLAYER player[MAX_PLAYER];
extern AVATAR avatar[MAX_PLAYER];
extern EC ec;
extern PLAY play;
extern SCROLLINFO siH, siV;
extern char *pMatrix;

////////////////////////////////////////////////////////////////
// Prototype Window, Dialog Function
LRESULT CALLBACK WndMainProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
LRESULT CALLBACK WndChildProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
LRESULT CALLBACK WndPlayProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
LRESULT CALLBACK WndCreditProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
BOOL	CALLBACK DlgSettingProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WndDrawProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
BOOL	CALLBACK DlgIconProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
BOOL	CALLBACK DlgAboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

////////////////////////////////////////////////////////////////
// Prototype Funtion
void SaveAvatar();
void DefaultSetting();
void LoadSetting();
void SaveSetting();
void DrawBlock( int xDraw, int yDraw, char playerTurn, COLORREF crColor );
void CheckComFirst();
void NewGame();
void ShowStatus(char szBuffer[]);
void ReDrawPlayerBar();
void ReDrawBanner();
void CheckAll(char iMode);
char pBlock(int x, int y);
void SaveGame(char szFileName[]);
void LoadGame(char szFileName[]);
void Undo();
void Redo();
void MoveHiLight(int xPoint, int yPoint);
void ClickBlock(int xBlock, int yBlock );
void PlaySoundFile(HWND hWnd, char *pszFileName);
void ChangeLang();
void SetSetting();
void GetWindowSize(WNDTYPE *Wnd);

void CheckAll(char iMode);
int CheckPoint(int xCheck, int yCheck, int iPlayer, int *iPoint, int *iBlock);
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -