Exemple #1
0
int CMapFileIO::LoadTileList(std::list<CTile*>& List, CTileTypesDict& Dict,
							 XML_MANAGER_HANDLE xml, XML_NODE_HANDLE hNode) const
{
	XML_NODE_HANDLE node = RetrieveNode(xml, hNode, L"tile");
	if(!node)
		return 1;
	while(node)
	{
		List.push_back(LoadTile(Dict, xml, node));
		node = GetNextNode(xml, node);
	}
	return 0;
}
int main(int argc, char* argv[])
{
    _setmaxstdio(2048);
    uint32 threads = 4, extractFlags = 0;
    std::set<uint32> mapIds;

    if (!HandleArgs(argc, argv, threads, mapIds, Constants::Debug, extractFlags))
    {
        PrintUsage();
        return -1;
    }

    if (extractFlags == 0)
    {
        printf("You must provide valid extract flags.\n");
        PrintUsage();
        return -1;
    }

    Cache = new CacheClass();
    MPQHandler = new MPQManager();
    MPQHandler->Initialize();

    if (extractFlags & Constants::EXTRACT_FLAG_DBC)
        ExtractDBCs();

    if (extractFlags & Constants::EXTRACT_FLAG_MMAPS)
        ExtractMMaps(mapIds, threads);

    if (extractFlags & Constants::EXTRACT_FLAG_GOB_MODELS)
        ExtractGameobjectModels();

    if (extractFlags & Constants::EXTRACT_FLAG_TEST)
    {
        float start[] = { 16226.200195f, 16257.000000f, 13.202200f };
        float end[] = { 16245.725586f, 16382.465820f, 47.384956f };

        //
        float m_spos[3];
        m_spos[0] = -start[1];
        m_spos[1] = start[2];
        m_spos[2] = -start[0];

        //
        float m_epos[3];
        m_epos[0] = -end[1];
        m_epos[1] = end[2];
        m_epos[2] = -end[0];

        //
        dtQueryFilter m_filter;
        m_filter.setIncludeFlags(Constants::POLY_AREA_ROAD | Constants::POLY_AREA_TERRAIN);
        m_filter.setExcludeFlags(Constants::POLY_AREA_WATER);

        //
        float m_polyPickExt[3];
        m_polyPickExt[0] = 2.5f;
        m_polyPickExt[1] = 2.5f;
        m_polyPickExt[2] = 2.5f;

        //
        dtPolyRef m_startRef;
        dtPolyRef m_endRef;

        FILE* mmap = fopen("mmaps/001.mmap", "rb");
        dtNavMeshParams params;
        int count = fread(&params, sizeof(dtNavMeshParams), 1, mmap);
        fclose(mmap);
        if (count != 1)
        {
            printf("main: Error reading from .mmap\n");
            return 0;
        }

        dtNavMesh* navMesh = new dtNavMesh();
        dtNavMeshQuery* navMeshQuery = new dtNavMeshQuery();

        navMesh->init(&params);
        for (int i = 0; i <= 32; ++i)
        {
            for (int j = 0; j <= 32; ++j)
            {
                char buff[100];
                sprintf(buff, "mmaps/001%02i%02i.mmtile", i, j);
                LoadTile(navMesh, buff);
            }
        }
        
        navMeshQuery->init(navMesh, 2048);

        float nearestPt[3];

        navMeshQuery->findNearestPoly(m_spos, m_polyPickExt, &m_filter, &m_startRef, nearestPt);
        navMeshQuery->findNearestPoly(m_epos, m_polyPickExt, &m_filter, &m_endRef, nearestPt);

        if ( !m_startRef || !m_endRef )
        {
            std::cerr << "Could not find any nearby poly's (" << m_startRef << "," << m_endRef << ")" << std::endl;
            return 0;
        }

        int hops;
        dtPolyRef* hopBuffer = new dtPolyRef[8192];
        dtStatus status = navMeshQuery->findPath(m_startRef, m_endRef, m_spos, m_epos, &m_filter, hopBuffer, &hops, 8192);
        
        int resultHopCount;
        float* straightPath = new float[2048*3];
        unsigned char* pathFlags = new unsigned char[2048];
        dtPolyRef* pathRefs = new dtPolyRef[2048];

        status = navMeshQuery->findStraightPath(m_spos, m_epos, hopBuffer, hops, straightPath, pathFlags, pathRefs, &resultHopCount, 2048);
        std::vector<Vector3> FinalPath;
        FinalPath.reserve(resultHopCount);
        for (uint32 i = 0; i < resultHopCount; ++i)
        {
            Vector3 finalV = Utils::ToWoWCoords(Vector3(straightPath[i * 3 + 0], straightPath[i * 3 + 1], straightPath[i * 3 + 2]));
            FinalPath.push_back(finalV);
            printf("Point %f %f %f\n", finalV.x, finalV.y, finalV.z);
        }
    }

    return 0;
}
Exemple #3
0
void TerrainHolder::LoadTile(float x, float y)
{
    int32 tx = (int32)(32 - (x / TERRAIN_TILE_SIZE));
    int32 ty = (int32)(32 - (y / TERRAIN_TILE_SIZE));
    LoadTile(tx, ty);
}
void AGameHUD::DrawHUD()
{
	Super::DrawHUD();

	//Look to see if they want the crosshair active
	if (Crosshair && !bIsLoadinglevel && !bInMenu)
	{
		if (bShowCrosshair)
			DrawTexture(Crosshair);
	}

	//We must first check to see if the hover hand got set first to avoid errors!
	if (HoverHand && !bIsLoadinglevel && !bInMenu)
	{
		//Now, we check to see if we draw the hover hand or not
		if (bShowHoverHand)
			DrawTexture(HoverHand);
	}

	//FString Text = "You're Awesome!";
	//DrawText(Text, FVector2D::ZeroVector, HUDFont, FVector2D(1, 1), FLinearColor::White);

	if (bShowSubtitles && !bIsLoadinglevel && !bInMenu)
	{
		if (bIsInConversation) {
			//DrawText(SubtitleText, FLinearColor::White, 0, 250, HUDFont);
			int32 x = 0;
			int32 y = 0;
			FFontRenderInfo RenderInfo = FFontRenderInfo();
			Canvas->WrappedStrLenf(HUDFont, 1, 1, x, y, *SubtitleText);
			Canvas->WrappedPrint(true, Canvas->ClipX / 2, (Canvas->ClipY / 2 + (Canvas->ClipY / 2 * 0.6f)), x, y, HUDFont, 1, 1, true, true, *SubtitleText, RenderInfo);
			//DrawText(SubtitleText, FVector2D(0, 250), HUDFont, FVector2D(1, 1), FLinearColor::White);
		}
	}

	//Make sure this is always last in the draw method (Or, if not make sure to give the texture the highest Z-Index
	if (bIsLoadinglevel)
	{
		FCanvasTileItem LoadTile(FVector2D(0, 0), LevelLoadingTexture->Resource, FLinearColor::White);
		Canvas->DrawItem(LoadTile);

		if (bAlphaFlipPhase)
		{
			uint8 ChangeRate = 1;
			if (bIsIncreasing) {
				LoadingColor.A -= ChangeRate;
				if (LoadingColor.A <= 0) {
					bIsIncreasing = false;
					LoadingColor.A = 0;
				}
			}
			else {
				LoadingColor.A += ChangeRate;
				if (LoadingColor.A >= 100) {
					bIsIncreasing = true;
					LoadingColor.A = 100;
				}
			}

			DrawText("Press [Enter] To Continue . . .", FVector2D(0, 0), HUDFont, FVector2D(1, 1), LoadingColor);
		}
		else
			DrawText("Loading . . .", FVector2D(0, 0), HUDFont, FVector2D(1, 1), LoadingColor);
	}

	if (LoadedPicture != NULL)
		DrawTexture(LoadedPicture);

}