Ejemplo n.º 1
0
int main(int argc, const char **argv) // ignore_convention
{
	IKernel *pKernel = IKernel::Create();
	s_pStorage = CreateStorage("Teeworlds", IStorage::STORAGETYPE_BASIC, argc, argv);
	s_pEngineMap = CreateEngineMap();

	bool RegisterFail = !pKernel->RegisterInterface(s_pStorage);
	RegisterFail |= !pKernel->RegisterInterface(s_pEngineMap);

	if(RegisterFail)
	{
		delete pKernel;
		return -1;
	}

	s_File = s_pStorage->OpenFile("map_version.txt", IOFLAG_WRITE, 1);
	if(s_File)
	{
		io_write(s_File, "static CMapVersion s_aMapVersionList[] = {\n", str_length("static CMapVersion s_aMapVersionList[] = {\n"));
		s_pStorage->ListDirectory(1, "maps", MaplistCallback, 0);
		io_write(s_File, "};\n", str_length("};\n"));
		io_close(s_File);
	}

	delete pKernel;
	return 0;
}
Ejemplo n.º 2
0
void CMapLayers::OnInit()
{
	if(m_Type == TYPE_BACKGROUND)
	{
		m_pMenuLayers = new CLayers;
		m_pMenuMap = CreateEngineMap();

		int HourOfTheDay = (time_timestamp()/3600)%24;

		char aBuf[128];
		str_format(aBuf, sizeof(aBuf), "ui/%s_%s.map", g_Config.m_ClMenuMap, (HourOfTheDay >= 6 && HourOfTheDay < 18) ? "day" : "night");
		if(!m_pMenuMap->Load(aBuf, m_pClient->Storage()))
		{
			str_format(aBuf, sizeof(aBuf), "map '%s' not found", g_Config.m_ClMenuMap);
			Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client", aBuf);
			return;
		}

		str_format(aBuf, sizeof(aBuf), "loaded map '%s'", g_Config.m_ClMenuMap);
		Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client", aBuf);

		m_pMenuLayers->Init(Kernel(), m_pMenuMap);
		RenderTools()->RenderTilemapGenerateSkip(m_pMenuLayers);
		m_pClient->m_pMapimages->OnMenuMapLoad(m_pMenuMap);
		LoadEnvPoints(m_pMenuLayers, m_lEnvPointsMenu);
	}
}
Ejemplo n.º 3
0
void CMapLayers::OnInit()
{
	if(m_Type == TYPE_BACKGROUND)
	{
		m_pMenuLayers = new CLayers;
		m_pMenuMap = CreateEngineMap();

		LoadBackgroundMap();
	}
}
Ejemplo n.º 4
0
CBackground::CBackground()
{
	m_pLayers = new CMapLayers(CMapLayers::TYPE_BACKGROUND);
	m_pLayers->m_pLayers = new CLayers;
	m_pBackgroundLayers = m_pLayers->m_pLayers;
	m_pImages = new CMapImages;
	m_pBackgroundImages = m_pImages;
	m_pMap = CreateEngineMap();
	m_pBackgroundMap = m_pMap;
	m_Loaded = false;
	m_aMapName[0] = '\0';
}
Ejemplo n.º 5
0
void CMapLayers::OnInit()
{
	if(m_Type == TYPE_BACKGROUND)
	{
		m_pMenuLayers = new CLayers;
		m_pMenuMap = CreateEngineMap();

		char aBuf[128];
		str_format(aBuf, sizeof(aBuf), "maps/%s.map", g_Config.m_ClBackgroundMap);
		if(!m_pMenuMap->Load(aBuf, m_pClient->Storage()))
		{
			str_format(aBuf, sizeof(aBuf), "map '%s' not found", g_Config.m_ClBackgroundMap);
			Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client", aBuf);
			return;
		}

		str_format(aBuf, sizeof(aBuf), "loaded map '%s'", g_Config.m_ClBackgroundMap);
		Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client", aBuf);

		m_pMenuLayers->Init(Kernel(), m_pMenuMap);
		RenderTools()->RenderTilemapGenerateSkip(m_pMenuLayers);
		m_pClient->m_pMapimages->OnMenuMapLoad(m_pMenuMap);
	}
}