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

📄 match.h

📁 一个3D的保龄球的源代码
💻 H
字号:
// Match.h: interface for the CMatch class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MATCH_H__6C9E0274_9502_420F_8BE3_2C0BDD491161__INCLUDED_)
#define AFX_MATCH_H__6C9E0274_9502_420F_8BE3_2C0BDD491161__INCLUDED_

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

#include "def.h"
#include "..\System\gfx.h"
#include "Datamanager.h"
#include "CPlayer.h"

// animation of coin
#define COIN_ROTATE_START 0
#define COIN_ROTATE_END 9
#define COIN_RFLY_START 10
#define COIN_RFLY_END	30
#define COIN_LFLY_START 40
#define COIN_LFLY_END 60

#define TV_START 0
#define TV_END 30

class CEngine;
class CKeyinput;
class CFont;
class CScene;
#define MAX_PLAYER_COUNT			2


class CMatch  
{
public:

	CFont *m_pFont;

	CMatch(CEngine *pEngine);
	virtual ~CMatch();

	bool calculateScore(ScoreInfo *scoreInfo, Byte numFallPin);
	void CalculateAfterCollision();//int tenpinState);//
	//clear old match data, setup a new match with "round count" and "player count"
	void InitMatch(byte roundCount, byte playerCount);

	//pass current pinMode here and get falled pins and score.
	void SetCurDevliveryResult(int pinMode){m_curPinMode[m_curPlayer] =pinMode; };

	//update data to next delivery
	bool NextDelivery();

	//inline functions
	void SetPlayer(byte playerIndex, byte playerId) {m_Players[playerIndex] = playerId; };	
	void SetPlayerBall(byte playerIndex, byte ballId) {m_PlayerBall[playerIndex] = ballId; };
	void SetBallIconID(byte playerIndex, byte ballIconId) {m_BallIconID[playerIndex] = ballIconId; };//Milo 01-07

	void SetPlayerAI(byte playerIndex, bool hasAI) {m_PlayersAI[playerIndex] = hasAI?1:0; };	
	byte GetPlayerID(byte index) {return m_Players[index];};
	void SetInitPinMode(int pinMode) { m_InitPinMode = pinMode;};
	int GetCurPinMode() { return m_curPinMode[m_curPlayer];};
	byte GetCurRoundNumber() { return m_curRound[m_curPlayer];};
	byte GetCurPlayer() {return m_curPlayer; };
	void SetCurPlayer(byte player) {m_curPlayer = player; };
	byte GetPlayerCount() {return m_PlayerCount; };
	void SetPlayerCount(byte num) {m_PlayerCount=num; };
	byte GetRoundCount() {return m_RoundCount; };
	void SetRoundCount(byte num) {m_RoundCount=num; };
	byte GetCurPlayerID() {return m_Players[m_curPlayer]; };
	byte GetCurPlayerAI() {return m_PlayersAI[m_curPlayer]; };
	byte GetCurBallID() {return m_PlayerBall[m_curPlayer]; };
	int GetCurBallIconID() {return m_BallIconID[m_curPlayer]; }; //Milo 01-07	
	int GetCurPlayerClothes() {return m_PlayerClothesID[m_curPlayer]; }; //Milo 01-19	
	void SetCurPinMode(int pinMode){m_curPinMode[m_curPlayer] = pinMode; };

	bool GetMatchFinish() {return m_bIsFinish; };
	void SetMatchFinish(bool flag) {m_bIsFinish=flag; };
	bool GetDrawMatchFinish() {return m_bIsDrawFinish; };
	void SetDrawMatchFinish(bool flag) {m_bIsDrawFinish=flag; };

	int GetMatchType() {return m_iMatchType; };
	ScoreInfo *GetPlayerScore(byte playerIndex){ return &m_Scores[playerIndex]; };
	void SetScoreBoardOffset(int offset){m_Scores[m_curPlayer].m_offSet = offset; };
	void SetLane(int id){m_LaneId=id;}
	int GetLane(){return m_LaneId;}
	int GetGrab(){return m_iGrabId;}
	void Init();


public:	
	int getCurrentTotalScore(ScoreInfo *scoreInfo);
	void LoadMatchRes(CDataManager *pMgr, int step);
	void SetMatchType(int type);


private:
	//int m_iMaxRoundNumber;
	int m_iBonusPinState;
	bool m_bIsFinish;
	bool m_bIsDrawFinish;
	void iniScoreInfo(ScoreInfo &scoreInfo);

	void restart();


	int m_LaneId;      //the lane we choose
	int m_iGrabId;	   //the texture id of GRAB	
	int m_InitPinMode; //basically we only have common type like 4-3-2-1

	byte m_curRound[MAX_PLAYER_COUNT];		//current round of the match

	byte m_RoundCount;	//the round count of this match

	byte m_PlayerCount; //player count participated in this match
	byte m_curPlayer;		//which player's turn

	ScoreInfo m_Scores[MAX_PLAYER_COUNT];
	byte m_Players[MAX_PLAYER_COUNT];				//player's id, the player's in this match
	byte m_PlayersAI[MAX_PLAYER_COUNT];				//player's AI: 1, has ai; 0, no ai;

	byte m_PlayerBall[MAX_PLAYER_COUNT];				//player's id, the player's in this match
	int m_BallIconID[MAX_PLAYER_COUNT];				//ball's Icon id, //Milo 01-07
	int m_curPinMode[MAX_PLAYER_COUNT]; //the pins' lefted on the lane
	int m_PlayerClothesID[MAX_PLAYER_COUNT];				//player's Clothes id, //Milo 01-19
//from Orginal Game  //Milo 11-05

	CEngine * m_pEngine;
	CKeyinput *m_pInput;	
	//the state of in the game
	//int m_staRound; // become ---- int m_curStatus
	bool m_bPause;

	//it stores the current number of rounds;the max rounds in a match is 10, so 0-9
	//Byte m_roundNumber; // become ---- int m_curRound


	// path of image interface	

public: 
	void SwitchToFinish(int cheatMode);
	int setImmediateComResult(int& count);
	int m_iMatchType;			// match type: MATCH_TYPE_VS, MATCH_TYPE_FREE, MATCH_TYPE_BONUS

	bool m_smIsStoryMode;
	char* m_smpWords;		// in talk mode, the content of the sencent
	int m_smWordsPlayerId;	// in talk mode, the player who speak
	int m_MatchResult; // -1 no result, 0 lose, 1 win.
	bool m_smWordsFinished;
	bool m_smWordsNextPage;

	bool m_smUCoinPassed;  // 10 rounds each level, 4 coins each round
//	bool m_smUCoinPassed;  // 10 rounds each level, 4 coins each round




//// << ============================================================================================
//// 2005.1.12 YI WEN HU
public:
	void JumpToNextRound();
	void SetExtraResult(int pinMode);
	bool ExtraNext();

	void skipHumanRound();
	void finishOnlineGame();

	//// m_mode and m_iMatchType are different
	//// m_iMatchType: the type of the match, including MATCH_TYPE_FREE, MATCH_TYPE_VS, MATCH_TYPE_BONUS
	//// m_mode: the type of the current game mode, including MODE_QUICK, MODE_FREE, MODE_BONUS,
	////         MODE_CAMERA, MODE_STORY
	int m_mode;
	CPlayer m_player[2];

	StoryStage* m_pCurStage;
	StoryMode*	m_pCurStoryMode;
	int m_smPlayerId;
	int m_smBallId;
	int m_smStageIndex;
	int m_smWordsIndex;

	void ResetScoreRecord();

	void SkipDelivery();

	int m_BonusId;
	int m_bnPassed;
	int m_bnLevel;
	int m_bnRound;

	byte GetPlayerRound(int playerIndex){return m_curRound[playerIndex];};
	byte GetPlayerAI(int playerIndex){return m_PlayersAI[playerIndex];};
	byte GetPlayerBall(int playerIndex){return m_PlayerBall[playerIndex];};
	int  GetPlayerPinMode(int playerIndex){return m_curPinMode[playerIndex];};
	byte GetPlayerBallIcon(int playerIndex){return m_BallIconID[playerIndex];};
	int GetPlayerClothes(int playerIndex){return m_PlayerClothesID[playerIndex];};


	void SetPlayerRound(int playerIndex, int num){m_curRound[playerIndex]=num;};
	void SetPlayerBall(int playerIndex, int num){m_PlayerBall[playerIndex]=num;};
	void SetPlayerPinMode(int playerIndex, int num){m_curPinMode[playerIndex]=num;};
	void SetPlayerBallIcon(int playerIndex, int num){m_BallIconID[playerIndex]=num;};
	void SetPlayerClothes(int playerIndex, int num){m_PlayerClothesID[playerIndex]=num;};

	
	void SetCurPlayer(int num){m_curPlayer=num;};

//// >> ============================================================================================


	int m_cnMatchCount;		// how many match we have played totally.
	int m_cnNextUCoinMatch;	// index of next unlock coin match
	int m_cnNextFCoinMatch;	// index of next function coin match

	bool m_hasUnlockCoin;	// true, if has a unlock coin in this match
							// unlock coin: bonus coin and/or ball coin
							// function coin: freeze coin and/or reverse coin
	bool m_hasFuncCoin;		// true, if has a function coin

	int m_uCoinRound;		// the index of the round unlock coin exists
	bool m_uCoinPassed;		// true, if unlock coin passed
	int m_uCoinType;		// CT_BONUS, CT_BALL
	int m_uCoinInfo;		// the index of bonus game, if is bonus game coin
							// the index of ball, if is bonus ball coin
	Vector4s m_uCoinPos;	// position of unlock coin


	int m_fCoinRound;		// the index of the round function coin exists
	bool m_fCoinPassed;		// true, if function coin passed
	int m_fCoinType;		// COIN_FREEZE, COIN_REVERSE
	Vector4s m_fCoinPos;	// position of function coin

	bool m_cnReplayHide;		// true, if the coin is hide in this delivery; use for replay
	Vector4s m_cnInitPos;


};

#endif // !defined(AFX_MATCH_H__6C9E0274_9502_420F_8BE3_2C0BDD491161__INCLUDED_)

⌨️ 快捷键说明

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