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

📄 cscene.h

📁 一个3D的保龄球的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
* ============================================================================
*  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.
*
* ============================================================================
*/

#include "DataManager.h"	// Added by ClassView
#if !defined AFX_SCENE_H
#define AFX_SCENE_H

#define _NOT_RELEASE     // for release version switch

#include "..\3d\Vector.h"	// Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "def.h"
#include "..\3d\render3d.h"

#include "CPlayer.h"
#include "Game.h"
#include "CBall.h"
#include "CTenpin.h"
#include "match.h"
#include "..\System\gfx.h"
#include "..\dynamics\physics.h"


typedef struct _PlayerAI
{
	int position;
	int power;
	int aimSpot;
	int rotation;
}PlayerAI;

#define GET_PRECISION(precision)		(3 - precision)*20

const int TITLE_FIRST_ANI = 1;
const int TITLE_SECOND_ANI = 2;
const int TITLE_ANI_DONE = 3;

const int FOV_POSITION_CONFIRM = 80;
const int FOV_CAMERA_VIEW = 256;
const int FOV_OTHERS = 160;
const int FOV_FORWARD = 114;


const int HAND_POSITION_Z = 90;
const int HAND_POSITION_Y = -120;

const int STOP_ON_FOULS_FEET = 12; //30

const int WITHOUT_CHEAT				= 0;
const int CHEAT_OPEN				= 9;
const int CHEAT_ALLPINS_FALL		= 10;
const int CHEAT_WIN_TO_MATCH		= 11;
const int CHEAT_LOSE_TO_MATCH		= 12;
const int CHEAT_DRAW_TO_MATCH		= 13;
const int CHEAT_JUMP_TO_NEXT_ROUND	= 14;

const int COIN_VIEW_DONE  = 5;
const int COIN_VIEW_SHOWING = 6;
//const for the return value of UPDATESENCE FUNCTION
const int PAUSE_RETURN			= 0;
const int NORMAL_RETURN			= 1;
const int SCOREBOARD_RETURN		= 3;
const int MATCH_FINISH_RETURN	= 5;
const int MATCH_DRAW_RETURN		= 7;
const int TENPIN_VIEW_RETURN	= -1;

enum {
	WITHOUT_TV_ANI = 0,
	TV_ANI_SHOW,
	TV_ANI_SHOW_DONE,
	TV_ANI_PLAYER_DONE,
	TV_ANI_ROLL_BACK,
	TV_ANI_FINISH,
};
enum {
		WITHOUT_ANI = 0,
		ANI_TURKEY_STRIKE,
		ANI_FENCE_COLLISION,
		ANI_NORMAL_COLLISION,
		ANI_IN_GUTTER,
		ANI_COLLISION_STRIKE,
		ANI_COLLISION_SPARE,
		ANI_COLLISION_SPLIT,
};
const int WITHOUT_TUTORIAL					= 0;	//00000000
const int TUTORIAL_POSITION					= 1;	//00000001
const int TUTORIAL_POWER					= 2;	//00000010
const int TUTORIAL_OVER_POWER				= 4;	//00000100
const int TUTORIAL_FOUL						= 8;	//00001000
const int TUTORIAL_DIRECTION				= 16;	//00010000
const int TUTORIAL_SPIN_CONTROL				= 32;	//00100000
const int TUTORIAL_REPLAY_INSTRUCTION		= 64;	//01000000
const int TUTORIAL_FINISH					= 127;	//01111111


#define	AIM_CENTER			60
#define	AIM_LEFT			40
#define	AIM_RIGHT			80
#define	AIM_WIDE_LEFT		20
#define	AIM_WIDE_RIGHT		100
#define	AIM_WIDEST_LEFT		0
#define	AIM_WIDEST_RIGHT	120

#define TYPE_LEFT_TENPIN_LEFT		0x0078		 
#define TYPE_CENTER_TENPIN_LEFT		0x001c
#define TYPE_RIGHT_TENPIN_LEFT		0x000f
#define TYPE_SPLIT_TENPIN_LEFT		0x0077

#define DISTANCE2PINS				(8)

#define  TYPE_SPLIT_0		0x240	//1001000000 6,9
#define  TYPE_SPLIT_1		0x248	//1001001000 3,6,9
#define  TYPE_SPLIT_2		0x260	//1101100000 5,6,9
#define  TYPE_SPLIT_3		0x268	//1001101000 3,5,6,9
#define  TYPE_SPLIT_4		0x228	//1000101000 3,5,9 

//the PLAYER ROSK's ID...
const int ROSSE_ID=2;
const int KOMAN_ID=3;
const int LEE_ID=0;
const int TIGER_ID = 1;
const int NICO_ID=4;
const int RAY_ID=5;
//for the AI random mode
const int RETURN_RANDOM_STRIKE=ANI_COLLISION_STRIKE;
const int RETURN_RANDOM_SPARE=ANI_COLLISION_SPARE;
const int RETURN_RANDOM_NORMAL=ANI_NORMAL_COLLISION;

const int TOTAL_LEVEL=5;
const int TOTAL_TYPE=4;//0-RIGHT/LEFT/CENTER;1-SPLITE;2-OTHER;3-ALL 
const int TOTAL_SITUATION=2;//0-Strike;1-spare
// TENPIN STATE TYPE
const int TYPE_LRC=0;
const int TYPE_SPLIT=1;
const int TYPE_OTHER=2;
const int TYPE_ALL=3;

#define CAMERAVIEW_KEY_COUNT	10

#define COLLIDE_LOOK_FORWARD	1
#define COLLIDE_LOOK_CENTER		2
#define COLLIDE_LOOK_RIGHT		3
#define COLLIDE_LOOK_BACK		4

//the full strike probability of the AI according to the tenpin status
const int PROBABILITY_TENPIN_FULL[TOTAL_TYPE][TOTAL_LEVEL]={
	{ 0, 0, 0, 0, 0},//TYPE RIGHT/LEFT/CENTER
	{10,15,20,25,30},//TYPE SPLITE
	{10,15,20,25,30},//TYPE OTHER
	{10,15,20,30,40}//TYPE ALL
};
//the striked tenpin number of the AI according to the the tenpin status if AI cannot eliminate all tenpin
const int TENPIN_STRIKED_NUMBER_PROBABILITY[TOTAL_TYPE][TOTAL_LEVEL]={
	{60,70,80,90,100},//TYPE RIGHT/LEFT/CENTER
	{50,50,50,50, 50},//TYPE SPLITE
	{50,60,70,80, 90},//TYPE OTHER
	{40,50,60,70, 80}//TYPE ALL
};

//the strike probability of the first round
const int PROBABILITY_TENPIN_FIRST_FULLSTRIKE[TOTAL_LEVEL][TOTAL_SITUATION]={
	{ 6,30},
	{ 8,40},
	{10,40},
	{15,45},
	{18,50}
};
//the eliminated tenpin number of the first round
const int TENPIN_FIRST_STRIKE_NUMBER_PROBABILITY[TOTAL_LEVEL]={5,6,7,8,9};

// the initial tenpin position
const int TENPIN_INIT_POS[TOTAL_TENPIN_NUMBER][2]={
		{  0,2020},//tenpin 0
		{-15,2050},//tenpin 1
		{ 15,2050},//tenpin 2
		{-31,2075},//tenpin 3
		{  0,2075},//tenpin 4
		{ 30,2075},//tenpin 5
		{-47,2105},//tenpin 6
		{-15,2105},//tenpin 7
		{ 15,2105},//tenpin 8
		{ 45,2105},//tenpin 9		
	};
//the code to start cheat mode
const int OPEN_CHEAT_CODE[8]={0,1,2,3,0,1,2,3};


// for replay
#define TOTAL_REPLAY_FRAME		112+100
#define TOTAL_TV_FRAME			(TOTAL_REPLAY_FRAME+50)

enum{
	RPL_POS_X=0,
		RPL_POS_Y=1,
		RPL_POS_Z=2,
		RPL_ROT_X=3,
		RPL_ROT_Y=4,
		RPL_ROT_Z=5,
		RPL_STATUS=6,
};





class CObject;
class CEngine;
class CCameraControl;
class CKeyinput;
class CMatch;
class CUI;

class CScene 
{
public:
	
	CScene(CEngine *p, CMatch *pMatch, CDataManager *pDataManager);
	~CScene();
	
	bool Load();
	int UpdateScene(byte withAI);	
	void SetCurHint(int curHint) { m_curHint = curHint;};
	bool GetReplayStatus(){return m_bReplay;};
	int GetTvAniStatus(){return m_bTvOn;};
	int GetIsTutStage(){return m_bIsTutStage;};
	int GetTvOn(){return m_bTvOn;};
	
	bool GetWitheScreen(){return m_bWitheScreen;};
	void clearWitheScreen(){m_bWitheScreen=false;};

	int GetCoinMode(){return m_iCoinMode;};
	int GetCheatMode(){return m_iIsCheat;};
	bool GetIsWholeScoreBoard(){return m_bWholeScoreBoard;};
	bool GetIsDraw(){return m_bIsDraw;};
	void SetIsWholeScoreBoard(bool flag){m_bWholeScoreBoard=flag;}; 
	void SetIsDraw(bool flag){m_bIsDraw=flag;}; 
	void SetTutorialStage(int stage){m_iTutorialStage=stage;}; 
	int GetTutorialStage(){return m_iTutorialStage;};
	int GetCurTutorialStage(){return m_iCurTutoial;};
	
	int GetSoundID(){return m_iSoundPlay;};

	//add condition to fix the automatic through after ingame menu closed bug.
	void SetMoving(bool flag){if (m_curStage != DS_AIM_SPOT_CONFIRM) m_bMoving=flag;};

	int GetSaveDone(){return m_iSaveDone;};
    void SetSaveDone(int saveType){m_iSaveDone=saveType;}; 

	int GetPanelDownCount(){return m_panelDownCount;};
	bool GetIsInTenpinArea(){return m_isInTenpinArea;};
	bool GetIsCollisionFinished(){return m_bIsCollisionFinish;};
	int GetTvAniPlaying(){return m_bTvAniPlaying;};
	void DrawTvAni(CUI *pUI);
	void SetStage(int stage, int withAI = FALSE);
//	void CoinResultProcess();
	void CoinReset();
	void CameraView();
	void CameraViewInit();
	bool IsSplit();
	int GetCurHint();
	void GetDirection(int &ret);
	void DeliveryInit();
	void MatchInit();
	void Paint(CUI *pUI);	
	void drawLevelInfo(CUI *pUI);
	void CoinInit();
	void LinkPlayer(int index);
	void drawFinalInfo(CUI *pUI,int step);
	void renderScene(); // used to render all objects in the scene
	int GetReplayBallStartY(void);

	int m_curStage;	//store the CURRENT STAGE in one delivery
	bool m_view;	//for view the TENPINS in the scene
	CMatch* m_pMatch;	 //pointer points to the MATCH
	int m_ancPos;		 //the arrow direction 
	//the Player
	CPlayer* m_player; 
	bool m_bShowSecondPlayer; //the flag to show the second player in the scene in STORY MODE 
	
	//the tenpins
	CTenpin m_tenpin[TOTAL_TENPIN_NUMBER]; //There are ten tenpins in the game 

⌨️ 快捷键说明

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