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

📄 datamanager.h

📁 一个3D的保龄球的源代码
💻 H
字号:

#if !defined(AFX_DATAMANAGER_H__INCLUDED_)
#define AFX_DATAMANAGER_H__INCLUDED_

/*
* ============================================================================
*  Name     : DataManager.h: 
*  Part of  : Game
*  Created  : 2004-11-8 by Yi Wen Hu
*  Version  :
*  Copyright: Gameloft S.A.
*
* ============================================================================
*/
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

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

//#define DATAMANAGER_DEBUG 1

const int PLAYER_MODEL_COUNT = 8;
const int LANE_MODEL_COUNT = 1;
const int STRING_MAX_LENGTH = 20;

const int BALL_COUNT=6;
const int COIN_COUNT=26;
const int BONUS_COUNT=30;
const int PLAYER_COUNT=6;
const int LANE_COUNT=3;
const int CLOTH_COUNT=3;
const int BALLICON_COUNT=7;

// story stage id
#define SS_INTRODUCTION		10
#define SS_PRE_TALK			11
#define SS_LEVEL			14
#define SS_BONUS			15
#define SS_BOSSLEVEL		16


class CEngine;
class CPlayer;
class CBall;

typedef struct _PlayerRes
{
	char name[STRING_MAX_LENGTH];
	int power;
	int precision;
	int rotation;
	int mentation;
	byte modelIndex;
	byte ballIndex;

	int actionstart[PLAYER_ANI_COUNT];
	int actionend[PLAYER_ANI_COUNT];
	int actioninterval[PLAYER_ANI_COUNT];
	int actionkeep[PLAYER_ANI_COUNT];

	int ballStepsCount;
	int* pballTrace;

	int clothsCount;
	char** cloths;
	//Qiu Li, add decoration, 2005/2/2
	short *decor;
	//Qiu Li

}CPlayerRes;


struct LightItem
{
	byte lightid;
	int posx, posy, posz;
	int size;
};

struct Bg
{
	
	char modelIndex;
	char floorModelIndex;
	char skyboxModelIndex;
	char audienceIndex;
	char furnitureIndex;

	char name[15];
	byte lightTypeCount;
	char (*lightTexName)[STRING_MAX_LENGTH];
	LightItem *lights;
	byte lightItemCount;
	CTexture* lighttex;
	int *lightid;
	char grabTex[20];
	
};


struct Words
{
	int person;
	int stringId;
};


// for story mode
struct StoryStage
{
	// level / bonus
	int info;
	int type;
	int competitor;
	int place;

	// talk / introduction
	int words_count;
	Words* words;
};

struct Coin
{
	int id;
	int type;
	int info;
	int posX;
	int posY;

};


// story stage type 
#define SST_INTRODUCTION	0
#define SST_PRETALK			1
#define SST_LEVEL			2 
#define SST_BONUS			3
#define SST_BOSSLEVEL		4


// Story stage place
#define SSP_NIGHTCLUB		0
#define SSP_FACTORY			1


// coin types
#define CT_BONUS			0
#define CT_FREEZE			1
#define CT_REVERSE		2



struct StoryMode
{
	StoryStage* storyStages;
	int count;
	int characterId;
};


class CDataManager  
{

private:
	CRender3D* m_pRender;
	
	int m_iModelCount;
	int m_iBallCount;
	int m_iPlayerCount;
	int m_iBgCount;
	int m_iBonusCount;

public:

	CDataManager();
	~CDataManager();

	bool LoadResourceInfo(CEngine *pEngine);

	int LoadBallRes(int index);							//load the "index" ball's texture resource to local heap.
	int LoadPlayerRes(int index, int clothIndex);						//load the "index" Player's model file to local heap.
	void LoadPlayerInfo(int index, CPlayer *pPlayer);	//load the "index" Player's default infomation.
	void LoadBallInfo(CEngine* pEngine,int index, CBall *pBall);			//load the "index" ball's default infomation.
	int LoadBgRes(int index);							//load the "index" lane's model file

	void LoadStoryMode(int PlayerId, StoryMode **pStoryMode);

	void LoadSounds(CSound* pSound);


	void SetRender(CRender3D* pRender);
	CRender3D* GetRender3D()	{	return m_pRender;	};
	const Bg* GetBgInfo(int index) { return &m_pBgs[index];	};


	int GetModelCount(){return m_iModelCount;}
	int GetBallCount(){return m_iBallCount;}
	int GetPlayerCount(){return m_iPlayerCount;}
//	int GetCoinCount(){return m_iCoinCount;}
	int GetBgCount(){return m_iBgCount;};
	
	bool LoadModel(int index) {	return m_pRender->LoadModel(m_pModelFile[index], index);};

	void LoadCoinTexture();

		// model
	char(* m_pModelFile)[STRING_MAX_LENGTH];
	
	// ball
	int* m_pBallWeight;
	char(* m_pBallTexture)[STRING_MAX_LENGTH];
	char(* m_pBallName)[STRING_MAX_LENGTH];

	// player
	CPlayerRes* m_pPlayer;

	// coin

	short* m_pBonuses;

	//bg
	Bg * m_pBgs;

	char m_StringFile[STRING_MAX_LENGTH];

	int m_StringCount;
	//Qiu Li, 2005-1-31
	//char(* m_pStringItem)[200];
	char **m_pStringItem;
	int m_StringLength;
	char *m_pStringBuffer;
	//Qiu Li end


	// story mode data
	int m_StoryModeCount;

	StoryMode *m_StoryModes;

	// coins
	int m_pCoinTexture[4];

	int m_CoinLevelRounds[5];
	int m_CoinRoundCoins[5][10];

	Coin*** m_Coins;



#ifdef DATAMANAGER_DEBUG
	void Test();
#endif
};

#endif

⌨️ 快捷键说明

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