fiveplusgamemodel.h

来自「该程序功能:用JAVa实现的彩色五珠棋小游戏」· C头文件 代码 · 共 118 行

H
118
字号
// FivePlusGameModel.h: interface for the CFivePlusGameModel class.
//
//////////////////////////////////////////////////////////////////////
#include "RadomGenerator.h"

#if !defined(AFX_FIVEPLUSGAMEMODEL_H__11540747_F046_44FC_8F41_6D59529EF374__INCLUDED_)
#define AFX_FIVEPLUSGAMEMODEL_H__11540747_F046_44FC_8F41_6D59529EF374__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000



#define GRID_NUM_HOR 9
#define GRID_NUM_VER 9

//

enum OccupyObject {
	NOTHING,
	RED,
	GREEN,
	BLUE,
	YELLOW,
	CYAN,
	BLACK,
	PURPLE,
	FREEDOM,
	CRACKER
};

enum ClickOperation{
	NO_OPERATION,
	SELECT_CHESSMAN,
	MOVE_CHESSMAN
};
/*struct FivePlusGrid{
	POINT p;
	OccupyObject oo;
};*/

#include "RadomGenerator.h"

#include "HighScoreModel.h"	// Added by ClassView
class CFivePlusGameModel : public CObject  
{
	DECLARE_SERIAL( CFivePlusGameModel )
public:
	UINT m_nShowInterval;
	UINT m_nSelectInterval;
	UINT m_nMoveInterval;
	void ResetRandom();
	int m_nCrack;
	int m_nAny;
	int m_nCommon;
	int m_nExtraScore;
	virtual void Serialize(CArchive &ar);
	/*Clear the invalid point.*/
	BOOL ClearInvalid();
	CHighScoreModel m_scoreModel;
	BOOL IsFill();
	int GetScore();
	BOOL CheckNewPoint();
	CList<CPoint, CPoint&> m_lstInvalidPoint;
	int CheckPoint(CPoint point, BOOL bClear = TRUE);
	int ClickPoint(CPoint point);
	CPoint m_ptSel;
	BOOL m_bHasSel;
	BOOL NextStep();
	BOOL NewGame();
	CFivePlusGameModel();
	virtual ~CFivePlusGameModel();
	int m_grid[GRID_NUM_HOR][GRID_NUM_VER];
	int m_currentGrid[3];
	CList<CPoint, CPoint&> m_lstPathPoint;
	CRadomGenerator m_rndBalls;

private:		
	BOOL FillGrid(int chessman);
	int m_nExtraChessman;
	int CountOccupy();
	void ResetDirection(CPoint from);
	int m_nBallStandard;
	int m_nScore;
	int CalScore(int nBallNum, CSize direction);
	BOOL DeleteAllInvalid(int nBall);
	int DirToDir(const CPoint point, const CSize direction);

	CList<CPoint, CPoint&> m_lstDeadPoint;
	BOOL FindPath();
	CPoint m_destPoint;
	
	CSize m_offSet[4];
	
	int LBToRT(const CPoint point);
	int RTToLB(const CPoint point);
	int LTToRB(const CPoint point);
	int RBToLT(const CPoint point);
	int TopToBottom(const CPoint point);
	int BottomToTop(const CPoint point);
	int LeftToRight(const CPoint point);
	int RightToLeft(const CPoint point);
	BOOL Equal(int firstBall, int secondBall);
	
	BOOL CanMoveTo();
	int MoveTo(const CPoint point);
	
	BOOL NextBalls();
	BOOL FillPanel();
	BOOL Initialize();
	
	CRadomGenerator m_rndXCoord;
	CRadomGenerator m_rndYCoord;
};

#endif // !defined(AFX_FIVEPLUSGAMEMODEL_H__11540747_F046_44FC_8F41_6D59529EF374__INCLUDED_)

⌨️ 快捷键说明

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