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

📄 cscene.h

📁 一个3D的保龄球的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
	/** the instance for Render 3D model */
	CRender3D m_render3D; //Milo;forRender3D 9-29
	
	CBall m_ball;			// the ball used in this delivery
	Physics *m_physics;		// the pointer points to a class that was used to simulate the whole collision 
	int m_frameIndex;		// the counter used to count the step in the particular stage (it will be reset at the beginning of every stage ) 
	bool m_changeFOV;		// used to judge if the FOV need be changed or not
	int m_rotationPower;	// the rotation LEVEL of the BALL in one delivery
	CObject* m_object[RENDER_COUNTS];	// store the all instances that need be rendered in one delivery 
	CCameraControl * m_cCamera;		// this instance is used to control the camera in the scene 	
	
	//variable for aim tips
	int m_aimPinId; //0~9
	int m_aimPinOffset; //-1, 0, 1
	int m_aimType; //-1, 0, 1

	int m_stringEffectTimer; // special for STORY MODE
	
	bool m_bIsVSWin; // the flag used to judge whether the player win or not, in the VS (Versus) MODE 

private:
	void playerStepMoving();
	void setCurTutorialStage(int stage, byte bAI);
	void skipCOMPlaying();
	
	int getTenpinState();		// used to get the tenpin states after collision
	void setInitBallState(int playerPower, int aimSpot, int withAI);	// used to set the ball state before throwing 
	bool step(byte withAI);									// used to calculate the next step or state of ball & tenpins until the collision finished
	void setInitTenpinState(int tenpinState);				// used to set states of tenpins at the beginning of each delivery
	void setRotationPower();				// when the ball is running on the LANE, this function is called to set the rotation level of the ball every step
	void setRoundInitInformation();							// used to set the new round information of BALL and PLAYER
															
	/*pinId: the pin that will be pointed to.(0-9)
	pinOffset:the offset of the pointed pin.(-1,0,1)
	pinType: the pin curve of the pin.(-1,0,1)
	*/
	void getRecommendSpot(int tenpinState,int &pinId, int &pinOffset,int &pinType);	
	void getPlayerFlag();									// used to indicate which PLAYER play this delivery
	
#ifdef _NOT_RELEASE
	void cheatCode();										// used to enter the CHEAT MODE 
	int isCheatOpen();
#endif

	void playingPlayerSound(int soundType);					// used to play the VOICE of PLAYER's
	bool CoinIsCollided();							// TIGER WRITE IT
	void CoinCollisionProcess();					// TIGER WRITE IT	
	void setCameraStage(int camStage,int frame=0);			// used to switch the stage of CAMERA
	void dealWithAfterCollision();							// used to set the voice & animations of PLAYER's, and calculate the score when the collision finished
	void movingHand(bool isBreath, bool isLeft);			// used to move hands when the player is moving and breathing 
	void switchToWaiting();									// jump to the finish of delivery
	void setHandPos();										// used to set the Init position of the HAND
	void draw2DStuff(CUI *pUI);								// used to PAINT the 2D interface of the scene 
	void setPlayerAI();										// set the AI of PLAYER's
	int getCurCameraForReplay();							// get the appropriate camer view to play the REPLAY of this delivery 

	int swithchWithCameraView();							// used to enter view tenpins function and back
	void grabbingTenpins(bool isStart, byte withAI);		// used to show the animation of grabbing tenpins
	bool isNoPinMoving();									// used to judge whether no pin is valid
	void rotationPowerAdjust();								// used to set the current rotation level of the ball, it is called each step when ball is running on the lane
	void playerPowerAdjust(byte withAI);					// used to set the player's throwing power 
	void playerPositionAdjust(byte withAI, bool bResOK = true);					// used to set the player's position
	void CoinRotate();								// TIGER WRITE IT	

	
//	int setAimSpot(int tenpinID);// set the shoot aim spot and standing position according to the tenpin state
	int getAimSpot(int tenpinState,int &spot, int &pos);// get the shoot aim spot and standing position according to the tenpin state
	int getTenpinStatus(int tenpinState, int &bRowTenpin,int &bColTenpin, int &countTenpinLeft);// get the tenpin info, return the first tenpin id
	int getAimSpotFromPos(int stdPos, int desPos);//get the aim spot from the start position and destination position 
	int processLeftType(int firstTenpin, int bRowTenpin, int bColTenpin,int &spot, int &pos);//process the left type tenpin left
	int processCenterType(int firstTenpin, int bRowTenpin, int bColTenpin,int &spot, int &pos);//process the center type tenpin left
	int processRightType(int firstTenpin, int bRowTenpin, int bColTenpin,int &spot, int &pos);//process the right type tenpin left
	
	int processSplitType(int tenpinState,int firstTenpin, int bRowTenpin, int bColTenpin,int &spot, int &pos);//process the split type tenpin left
	int processOtherType(int tenpinState,int firstTenpin, int bRowTenpin, int bColTenpin,int &spot, int &pos);//process the other type tenpin left
	
	int getLeftPinNumber(int tenpinState);// return the left side tenpin number
	int getRightPinNumber(int tenpinState);// return the right side tenpin number

	void setEliminatedTenpin(int count);// set the eliminated tenpin in AI random mode
	/*
	set the immediate computer result, return the strike result: strike, spare or normal
	parameter:
	first: ture if this is the first delivery of the computer
	firstScore: the first delivery score(0 if first is false)
	secondScore: the second delivery score(0, if there is no second delivery)
	*/
	int setImmediateComResult(bool First, int &firstScore,int &secondScore);

	void setRotPower(int flag); // set the constraint of max rotation power, according to the PLAYER's attribute 

	unsigned short * m_oldBuf;			//
	unsigned short * m_hand2DBuf;		//
	unsigned short * m_pTvBuf;		//
	int m_iSoundFlag;					// used to indicate which sound will be played
	bool m_bIsShaking;					// used to judge whether some tenpin is shaking
	bool m_bWitheScreen;				// used to display a white screen when the collision occur 
	bool m_isTransparent;				// used to judge whether the 3D model will be transparent
	CDataManager *m_pDM;				// the instance points to the DateManager Class
	int m_curCamera;					// used to store the current camera
	int m_iRecCount;					//
	int m_aRotRec[75][2];				// used to store the date of rotation level of ball for replay purpose
	Vector4s m_vBallStartPosition;		// store the 
	bool m_bReplay;						// the flag , true for in REPLAY MODE
	int m_iHandFrame;					// the counter used to simulate hand moving in some stage 
	bool m_bMovementFinished;			// the flag, true when the collision finished
	int random;							//

	int m_iCheatCode[3];				// cheat code array, 
	int m_iCheatPin[10];				// cheat code array, for pin
	int m_iBonusAni;					// the animation flag , used to indicate which animation will play
	bool m_bAutoReplay;					// used to flag the auto replay 
	int m_iBonusScore;					// 
	int m_iMulBonusScore;				// used to show the animation of score when the collision finished

	int m_iIsCheat; 
	
	bool m_bDirectResult;				// used to indicate whether to SKIP COM PLAYING IN VS MODE	 
	int m_colAni;						
	bool m_bWholeScoreBoard;			// used to indicate whether to show the whole scoreBoard in GAME
	int m_iSoundPlay;					// used to get the type of collision
	int m_curHint;						// used to indicate the content of HINT
	bool m_bCurHideProperty[RENDER_COUNTS];	// used to store the HIDE PROPERTIES of 3D Models in View TENPINS mode
	CEngine * m_pEngine;				// point to GAme Engine
	
//	CCollision m_cCollision;
	//add elements here
	/**the total time of ball movement*/
	int m_time;
	//the destination position of ball (the collision point between ball & tenpins)
	Vector4s m_ballDestinationPosition;
	/*int m_ballDestinationPositionX;
	int m_ballDestinationPositionY;*/
	
	
	//the flag to judge whether the ball into Tenpin Area
	bool m_isInTenpinArea;
	
	CKeyinput *m_pInput;				
	
	int m_iTutorialStage;
	bool m_bIsTutStage;
	int m_iCurTutoial;


	/** the total number of the frame */
	int m_nFrame;

	/** store the current tenpin State*/
	int m_currentTenpinState ;
	
	PlayerAI m_playerAI;				// used to store the AI of COM PLAYER
	bool m_bMoving;
	int m_iShowVSTurn;

public:
	int m_iRotationFlag;
	void PaintTitleAni(int titleType, CUI *pUI);
	int PlayingTitleAni(int titleType);
	void LoadTitleAni(int titleType);
	
	void DrawHintInfo(CUI *pUI, int y, int curHint);
	void DrawRoundDelivery(int matchState, int rollingTime, int saveQMFinishTime,
							   bool isShowHint, CUI *pUI, int storyState = -1);
	// coins for story mode
	bool m_cnHasCoin;			// 
	int m_cnCurCType;			// current coin's type
	bool m_cnPassed;

	bool m_cnIsReverse;			// reverse or not
	bool m_cnIsFreeze;			// freezed, means can not be controlled 
	int m_cnFlying;			// 0, not flying; 1 flying to right; -1 flying to left
	int m_prepareClock;
	bool m_bIsDraw;


	//Qiu Li, 2005/1/19
	const char *m_pEffectString[10];
	//Qiu Li end

	//for ai
	int m_iPlayerMoving; //0 for without moving 1 for left; 2 for right moving
	int m_iCoinMode;
	Vector4s m_vCoinPos;
	Vector4s m_vHandPos;

	int lCameraView_KeyMap[CAMERAVIEW_KEY_COUNT][2];


	bool m_bHasTitle;
	Vector4s m_lastPos;

	int m_collideLookType;
	int m_UISplashEndTime;

private:
	void playingAudiSound();
	long dist2power(Vector4s* p1,Vector4s* p2);




/************************************************************************/
/*                      REPLAY                                          */
/************************************************************************/

private:

	enum playTVType{
		TV_PLAY_FORWARD=1,
		TV_PLAY_BACKWARD=2,
		TV_PLAY_PAUSE=4,
		TV_PLAY_STEP_FORWARD=TV_PLAY_FORWARD+TV_PLAY_PAUSE,
		TV_PLAY_STEP_BACKWARD=TV_PLAY_BACKWARD+TV_PLAY_PAUSE,


	};
	
	enum playTVStatus{
		TV_STATUS_ERROR=0,
		TV_STATUS_END=1,
		TV_STATUS_START=2,
	};
	/*
	this is the replay data, the first dimension is the replay frame
	the second dimension is the object id
	the third dimension is the position, rotation and status data
	*/	
	short m_replayData[TOTAL_REPLAY_FRAME][TOTAL_OBJECT][7];
	
	int m_currFrame;// this is the current frame
	int m_totalFrame;// this is the total frame of the replay;
	int m_frameChange;
	
	int m_curCamId;// the id of the current camera in the TV mode
	int m_curCtrlId;//the id if the current control in the TV mode
	playTVType m_curPlayType;// the current play type;
	int m_panelDownCount;
	boolean m_isRollingOnLane;
	int m_iReplayCamStage;
	int m_iRollingCount;
	int m_iCurHintId;
	int m_iBoardOffset;
	int m_iCollisionFrm;
	

private:	
	//bool m_bDrawDone;
	int m_iSaveDone;

	int m_iTotalCounter;
	int m_iPlayerFinshAni;
	bool m_bIsCollisionFinish;
	bool strikeRelaying();
	void setInitTitleCol();
	bool titleCollision();
	void drawAllElements(int matchState, int rollingTime, int saveQMFinishTime, 
		bool isShowHint,CUI *pUI, bool bReplay, bool isWholeScorBoard, int showFlag, bool isStart, int powerBarStatus, bool dirAdj);

	void setFoulStage(int foulsType, byte ai);

	void setTvRollBack(int camera);
	void rollBackTv();
	int m_bTvAniPlaying;
	void coinCollisionOnLane();
	void playingTvAni();
	void replayingOnTv();
	int m_bTvOn;
	bool m_bTvPause;
	int m_iSaveFrameCnt;
	void saveReplayData(int frame);
	inline void TVPlayInit();
	int TVPlay(playTVType type);
	void animChange();// record data when animation is changed from player throw to ball run 
	void setEndAni();

public :
	bool IsMatchDraw();
	void TVScreen(CUI *pUI);
	void PaintingTVAni();
	void setCheat(int val){m_iIsCheat=val;}

//////////////////////////////////////////////////////////////////////////
//						 for the money system							//
//////////////////////////////////////////////////////////////////////////

};




#endif


⌨️ 快捷键说明

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