Beispiel #1
0
CBattleMap::CBattleMap(char* szFileName, char* szMapName, int nNumEnemies)
{
	m_pAssets		= CAssets::GetInstance();
	m_pTM			= CSGD_TextureManager::GetInstance();
	m_pGame			= CGame::GetInstance();
	m_pDI			= CSGD_DirectInput::GetInstance();

	//m_pCamera		= new CCamera();
	//m_pCamera->SetViewPosition(0, 0, -5);
	//m_pCamera->BuildPerspective(D3DX_PI/3, (float)(m_pGame->GetScreenWidth()/m_pGame->GetScreenHeight()), 0.1f, 100);

	m_pBitmapFont   = CBitmapFont::GetInstance();
	//  Sm_pFMOD			= m_pGame->GetFMODSystem();
	//	m_pHUD			= CHUD::GetInstance();

	m_pTilesL1 = NULL;
	m_pTilesL2 = NULL;
	m_pFreeTiles = NULL;
	//m_pMoveableTiles = NULL;

	m_nNumEnemiesLeft = nNumEnemies;
	m_szFileName = szFileName;
	m_szMapName  = szMapName;
	m_nNumCols = 0;
	m_nNumRows = 0;
	m_nTotalNumTiles = 0;
	m_nTileWidth = 0;
	m_nTileHeight = 0;
	m_nBGImageID = -1;
	m_nDotImageID = -1;
	m_nCurrSelectedTile = -1;
	m_nMapHeight = 0;
	m_nMapWidth = 0;
	m_nFreeTileCount = 0;
	m_fScrollX = 0.0f;
	m_fScrollY = 0.0f;

	m_nCursorImageID = m_pAssets->aBMcursorID;
	m_strCurrVersion = "TED-Version-1.0";
	LoadMapInfo();
	m_pAnimation = new CAnimation();
	m_pAnimation->Load("Resources/AnimationInfo/VG_Michelangelo.dat");
	m_pParticleSys = new CParticleSystem();
	m_pParticleSys->Load("Resources/ParticleInfo/VG_TestParticle.dat");
	//m_pParticleSys->InitGeometry();
	//m_pParticleSys->InitParticle();
	//m_pAnimation->Play();
	//CreateEnemies();
}
Beispiel #2
0
// Load new map
bool j1Map::Load(const char* file_name)
{
    bool ret = true;
    int numTileSets = 0;
    p2SString tmp("%s%s", folder.GetString(), file_name);

    char* buf;
    int size = App->fs->Load(tmp.GetString(), &buf);
    pugi::xml_parse_result result = map_file.load_buffer(buf, size);

//	RELEASE(buf);

    if(result == NULL)
    {
        LOG("Could not load map xml file %s. pugi error: %s", file_name, result.description());
        ret = false;
    }

    if(ret == true)
    {

        numTileSets = LoadMapInfo();// TODO 3: Create and call a private function to load and fill all your map data

    }

    if (numTileSets > 0)
        loadTileSet(numTileSets);// TODO 4: Create and call a private function to load a tileset

    if (map.numLayers > 0)
        LoadLayer(map.numLayers);//Fills maplayer with its information




    map_loaded = ret;

    return ret;
}
Beispiel #3
0
void CMapListHelper::Load()
{
	string_path					fn;
	FS.update_path				(fn, "$game_config$", "mp\\map_list.ltx");
	CInifile map_list_cfg		(fn);

	//read weathers set
	CInifile::Sect w			= map_list_cfg.r_section("weather");
	CInifile::SectCIt wi		= w.Data.begin();
	CInifile::SectCIt wi_e		= w.Data.end();
	for( ;wi!=wi_e; ++wi)
	{
		m_weathers.resize		(m_weathers.size()+1);
		SGameWeathers& gw		= m_weathers.back();
		gw.m_weather_name		= (*wi).first;
		gw.m_start_time			= (*wi).second;
	}

	// scan for additional maps
	FS_FileSet			fset;
	FS.file_list		(fset,"$game_levels$",FS_ListFiles,"*level.ltx");

	FS_FileSetIt fit	= fset.begin();
	FS_FileSetIt fit_e	= fset.end();

	for( ;fit!=fit_e; ++fit)
	{
		string_path					map_cfg_fn;
		FS.update_path				(map_cfg_fn, "$game_levels$", (*fit).name.c_str());
		LoadMapInfo					(map_cfg_fn, (*fit).name);
	}
	//scan all not laoded archieves
	LPCSTR tmp_entrypoint			= "temporary_gamedata\\";
	FS_Path* game_levels			= FS.get_path("$game_levels$");
	xr_string prev_root				= game_levels->m_Root;
	game_levels->_set_root			(tmp_entrypoint);

	CLocatorAPI::archives_it it		= FS.m_archives.begin();
	CLocatorAPI::archives_it it_e	= FS.m_archives.end();

	for(;it!=it_e;++it)
	{
		CLocatorAPI::archive& A		= *it;
		if(A.hSrcFile)				continue;

		LPCSTR ln					= A.header->r_string("header", "level_name");
		LPCSTR lv					= A.header->r_string("header", "level_ver");
		FS.LoadArchive				(A, tmp_entrypoint);

		string_path					map_cfg_fn;
		FS.update_path				(map_cfg_fn, "$game_levels$", ln);

		
		xr_strcat					(map_cfg_fn,"\\level.ltx");
		LoadMapInfo					(map_cfg_fn, ln, lv);
		FS.unload_archive			(A);
	}
	game_levels->_set_root			(prev_root.c_str());


	R_ASSERT2	(m_storage.size(), "unable to fill map list");
	R_ASSERT2	(m_weathers.size(), "unable to fill weathers list");
}
Beispiel #4
0
const Map *GetMap() {
	sprintf(msg_send, "query_map");
	strcpy(msg_receive, Communicate(msg_send));
	LoadMapInfo(msg_receive);
	return &MAP_;
}