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

📄 cplayer.h

📁 一个3D的保龄球的源代码
💻 H
字号:
/*
* ============================================================================
*  Name     : CTenpin.h: 
*  Part of  : Game
*  Created  : 2004-09-27 by Wei XIA
*  Implementation notes:
*   interface for the CTenpin class.
*  Version  :
*  Copyright: Gameloft S.A.
*
* ============================================================================
*/
#ifndef AFX_PLAYER_H
#define AFX_PLAYER_H

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

#include "def.h"
#include "Object.h"

const int PLAYER_ANI_FINISH			= 0;
const int PLAYER_ANI_PLAYING		= 1;
const int PLAYER_ANI_FOUL			= 2;
const int PLAYER_ANI_FOUL_FINISH	= -1;

enum{
		FOUL_TYPE_NONE = 0,
		FOUL_TYPE_FASTER_DIRECTION,
		FOUL_TYPE_FOUL
};

enum{
		FOUL_ANIM_NONE = 0,
		FOUL_LINE_ANIM,
		FOUL_TRIP_ANIM,
};
//return: 0 - finish 1 - not yet 2 - foul -1 - finish with foul

const int MAX_NAME_LENGTH = 20;

const int PLAYER_ANI_PLAYING_BACK = 1;

const int PLAYER_THROWING_SOUND	=	1;
const int PLAYER_LOSE_SOUND		=	2;
const int PLAYER_WIN_SOUND		=	3;

#define FOUL_POWER(ballWeight) (100-9-7*ballWeight)
#define MAX_SIZE 500


typedef struct _ActionTable
{
	int actionStart;
	int actionEnd;
	int actionInterval;
	int stopFrame;
}ActionTable;

class CPlayer :public CObject
{
public:
	int GetStopFrame();
	int GetAnimationOption();
	int GetIsFouls(int ballWeight);
	int GetStrength();
	int PlayingAnimation(bool isJump);
	int GetCurrentPower();
	bool MovingPlayer(bool isLeft);
	void SetCurrentPower(int ballWeight);
	int StrengthChanging(int ballWeight);
 	void SetAnimationOption(int animationOption, bool isPlayingBack = false);
	
	int GetClothesId() { return m_iClothesId;};
	void SetClothesId(int clothesId) {m_iClothesId = clothesId;};
	void SetMovingStep(int movingStep);
	int GetMovingStep() { return m_iMovingStep;};
	void ZeroMovingStep() { m_iMovingStep = 0;};
	
	virtual void Render(CRender3D *pR3d)	{
		if (!m_bHide)	{
			UpdateWorldMat(); // Milo 10-27
			CMesh *pMesh = pR3d->GetModelMesh(m_iModelID);
			if (pMesh != NULL)
			{
				pMesh->GetBBCenter(m_iCurFrame, m_BBCenter);
			}
			pR3d->RenderModel(m_iModelID, &m_matWorld, m_iCurFrame, m_iClothesId, m_decor[m_iClothesId]);
		}
	}
	CPlayer();
	CPlayer(int playerType, int strength, int precision, int rotation, int mentation, int currentLevel);
	
	~CPlayer();
	void restart();
	
	////////////////////////////////////////////private functions
	char m_name[MAX_NAME_LENGTH];
	int m_ballIndex;

	int m_strength ;
	int m_precision ;
	int m_rotation ;
	int m_mentation ;

	//Level attribute
	int m_currentLevel ;
	int m_tipsyDegree ;
	int m_currentState ;
	int m_playerType;
	//ScoreInfo m_scoreInfo ;

	//actionTable 4 animations
	ActionTable  m_actionTable[PLAYER_ANI_COUNT];

	//ball Trace
	int m_ballTraceCount;
	int m_ballTracePos[MAX_SIZE][3];
	int m_ballTraceRot[MAX_SIZE][3];
	int m_curPower;
	//this position will be used to draw the play
	/*int m_playerPosition[3];
	int m_playerRotation[3];*/
	int m_iFoulType;  //0 - finish 1 - not yet 2 - foul -1 - finish with foul
	int m_iPlayerID;
	//Qiu Li modify to draw decoration, 2005/2/2
	short m_decor[4];
	//Qiu Li end
	int m_iFoulAnimType;	//FOUL_LINE_ANIM, FOUL_TRIP_ANIM


	Vertex GetBBCenter() 
	{ 		
		Vertex center;
		UpdateWorldMat(); 
		center = m_matWorld.Transform(m_BBCenter);
		return center;
	};
	
private:
	int m_iAniPlayingBack;
	int getPowerLevel(int ballWeight);
	int m_iMovingStep;

	
	int m_count;
	int m_animationOption;
	int m_iClothesId; 
	Vertex m_BBCenter;
};


#endif

⌨️ 快捷键说明

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