Exemplo n.º 1
0
bool MapEditor::CreateMapData(int width, int height)
{
	
	if(!(width > 2 && height > 2))
	{
		//return false;
	}
	//³¤¿í±ØÐëÊÇ2µÄÃÝ+1
	if( ((1 << log2le(width)) != (width - 1)) && 
		((1 << log2le(height)) != (height - 1)))
	{
		return false;
	}

	SAFE_DEL_ARRAY(m_pMapData);
	m_pMapData = new float[width * height];
	memset(m_pMapData, 0, sizeof(float) * width * height);
	
	m_width = width;
	m_height = height;

	m_isModified = true;
	m_isMapSizeChanged = true;
	m_isDrawed = false;
	return true;
}
Exemplo n.º 2
0
		CSkyBox::~CSkyBox()
		{
			m_pRenderer->DestroyTexture(m_pTexture);
			m_pRenderer->DestroyGPUBuffer(m_pGPUBuffer);			
			SAFE_DEL_ARRAY(m_pBoxData);
			if (m_pRenderer)
				m_pRenderer->Decrease();
		}
Exemplo n.º 3
0
CPktQue::~CPktQue() {
	try {
		SAFE_DEL_ARRAY(pBuf);
		cs.Del();
	}
	catch(...) {
		Logout(_T("#ERR Occur an exception while running CPktQue::~CPktQue()"));
	}
}
Exemplo n.º 4
0
MapObject::MapObject(const char* filename,const char* heightmap_name, __INT32 _width, __INT32 _height, float scale, float scale_height, __INT32 detail):mVertices(NULL),mTextcoord(NULL),mIndices(NULL),mWidth(0),mHeight(0),
	mTextureID(0),mHeightMap(NULL),drawGrid(false),mIndices_grid(NULL),mGridColor(NULL),isPressed(false),scale(1),heightscale(1),selected(-1),mLogicMap(NULL),isDrag(false),MapCameraOffsetX(0),MapCameraOffsetY(0),detail_level(1),drawRange(false),boundarycolor(SColor<__UINT8>(255,255,255,255)),mCircleTextureID(0)
{
	mType = OBJECT_MAP;
	LoadTextureMap(filename);
	LoadHeightMap(heightmap_name);
	skybox = new SkyBox(PATH_GRAPHIC("HellSide5.tga"),PATH_GRAPHIC("HellSide3.tga"),PATH_GRAPHIC("HellSide6.tga"),PATH_GRAPHIC("HellSide1.tga"),PATH_GRAPHIC("HellSide2.tga"),PATH_GRAPHIC("HellSide4.tga"));
	SetMapProperties(_width,_height,scale,scale_height,detail);
	//initialize for mapLogic
	SAFE_DEL_ARRAY(mLogicMap);
	mLogicMap = new __INT32[mWidth*mHeight];
	for(int i = 0; i < mWidth*mHeight; i++)
	{
		mLogicMap[i] = OBJECT_NONE;	
	}
}
Exemplo n.º 5
0
bool MapEditor::LoadFromFile()
{
	FILE* f;
	f = _tfopen(LPCTSTR(m_str), L"rb");
	if(!f) goto OnOpenError;

	DWORD h = 0;
	if(fread(&h, sizeof(h), 1, f) < 1 || h != 'HMAP') 
	{
		goto OnOpenError;
	}

	if(fread(&m_width, sizeof(m_width), 1, f) < 1) 
	{
		goto OnOpenError;
	}

	if(fread(&m_height, sizeof(m_height), 1, f) < 1)
	{
		goto OnOpenError;
	}
	
	if(!CreateMapData(m_width, m_height) || fread(m_pMapData, sizeof(float), m_width * m_height, f) < m_width * m_height)
	{
		goto OnOpenError;
	}
	
	m_isModified = false;
	m_isMapSizeChanged = true;
	m_isDrawed = false;
	fclose(f);
	return true;

OnOpenError:
	SAFE_DEL_ARRAY(m_pMapData);
	m_str = _T("\0");
	if(f) fclose(f);
	return false;
}
Exemplo n.º 6
0
CMapObject::~CMapObject(void)
{
	SAFE_DEL_ARRAY(ObjectMap);
}
Exemplo n.º 7
0
MapEditor::~MapEditor(void)
{
	SAFE_DEL_ARRAY(m_pMapData);
}
Exemplo n.º 8
0
InGameState::~InGameState()
{
	SAFE_DEL_ARRAY(touch);
	RemoveList();
	SAFE_DEL_ARRAY(countChessAi);
}