예제 #1
0
파일: MAP.cpp 프로젝트: tuku/snoxd-koserver
///////////////////////////////////////////////////////////////////////
//	각 서버가 담당하고 있는 zone의 Map을 로드한다.
//
BOOL MAP::LoadMap(HANDLE hFile)
{
	LoadTerrain( hFile );
	m_N3ShapeMgr.Create((m_nMapSize - 1)*m_fUnitDist, (m_nMapSize-1)*m_fUnitDist);
	if( !m_N3ShapeMgr.LoadCollisionData(hFile) )
		return FALSE;

	if(	(m_nMapSize - 1) * m_fUnitDist != m_N3ShapeMgr.Width() || 
		(m_nMapSize - 1) * m_fUnitDist != m_N3ShapeMgr.Height() )
	{
		return FALSE;
	}

	int mapwidth = (int)m_N3ShapeMgr.Width();

	m_sizeRegion.cx = (int)(mapwidth/VIEW_DIST) + 1;
	m_sizeRegion.cy = (int)(mapwidth/VIEW_DIST) + 1;

	m_sizeMap.cx = m_nMapSize;
	m_sizeMap.cy = m_nMapSize;

	m_ppRegion = new CRegion*[m_sizeRegion.cx];
	for(int i=0; i<m_sizeRegion.cx; i++) {
		m_ppRegion[i] = new CRegion[m_sizeRegion.cy];
		m_ppRegion[i]->m_byMoving = 0;
	}

	LoadObjectEvent(hFile);
	LoadMapTile(hFile);

	InitializeCriticalSection( &g_region_critical );

	return TRUE;
}
예제 #2
0
bool SMDFile::LoadMap(FILE *fp, std::string & mapName, bool bLoadWarpsAndRegeneEvents)
{
	m_MapName = mapName;

	LoadTerrain(fp);

	m_N3ShapeMgr->Create((m_nMapSize - 1)*m_fUnitDist, (m_nMapSize-1)*m_fUnitDist);
	if (!m_N3ShapeMgr->LoadCollisionData(fp)
		|| (m_nMapSize - 1) * m_fUnitDist != m_N3ShapeMgr->Width() 
		|| (m_nMapSize - 1) * m_fUnitDist != m_N3ShapeMgr->Height())
		return false;

	int mapwidth = (int)m_N3ShapeMgr->Width();

	m_nXRegion = (int)(mapwidth / VIEW_DISTANCE) + 1;
	m_nZRegion = (int)(mapwidth / VIEW_DISTANCE) + 1;

	LoadObjectEvent(fp);
	LoadMapTile(fp);

	if (bLoadWarpsAndRegeneEvents)
	{
		LoadRegeneEvent(fp);
		LoadWarpList(fp);
	}

	return true;
}
예제 #3
0
bool SMDFile::LoadMap(FILE *fp)
{
	LoadTerrain(fp);

	m_N3ShapeMgr->Create((m_nMapSize - 1)*m_fUnitDist, (m_nMapSize-1)*m_fUnitDist);
	if (!m_N3ShapeMgr->LoadCollisionData(fp)
		|| (m_nMapSize - 1) * m_fUnitDist != m_N3ShapeMgr->Width() 
		|| (m_nMapSize - 1) * m_fUnitDist != m_N3ShapeMgr->Height())
		return false;

	int mapwidth = (int)m_N3ShapeMgr->Width();

	m_nXRegion = (int)(mapwidth / VIEW_DISTANCE) + 1;
	m_nZRegion = (int)(mapwidth / VIEW_DISTANCE) + 1;

	LoadObjectEvent(fp);
	LoadMapTile(fp);

#if defined(EBENEZER)
	LoadRegeneEvent(fp);	
	LoadWarpList(fp);
#endif

	return true;
}