Пример #1
0
void CMaNGOS_Map::SelectTile(float const* p)
{
    unsigned int tx, ty;
    GetGridCoord(p, ty, tx);
    m_LastTileX = tx;
    m_LastTileY = ty;
    if (m_SelectedTile)
    {
        if (m_SelectedTile->tx == tx && m_SelectedTile->ty == ty)
            return;

        delete m_SelectedTile;
        m_SelectedTile = NULL;
    }
    MeshObjects const* mo = m_MapInfos->GetMeshObjects(tx, ty);
    float const* bmin;
    float const* bmax;
    if (mo)
    {
        bmin = mo->BMin();
        bmax = mo->BMax();
    }
    else
        m_MapInfos->GetNavMeshTileBounds(tx, ty, bmin, bmax);
    m_SelectedTile = new SelectedTile(tx, ty, bmin, bmax);
}
static void CompareRadarAndCameraInPoint(const t_Point radar_point, const t_Point camera_point, int *p_similary) {
	t_Polygon radar_area;
	t_Polygon camera_area;
	t_GridCoord radar_coord;
	t_GridCoord camera_coord;
	char config_path[256];
	bool ok_radar_coord;
	bool ok_camera_coord;
	int similary;

	GetConfigPath(config_path, sizeof(config_path));
	GetRadarArea(config_path, &radar_area);
	GetCameraArea(config_path, &camera_area);
	ok_radar_coord = GetGridCoord(radar_area, radar_point, &radar_coord);
	ok_camera_coord = GetGridCoord(camera_area, camera_point, &camera_coord);
	if (false == ok_radar_coord || false == ok_camera_coord) 
		similary = 0;
	else
		similary = GetGridCoordSimilary(radar_coord, camera_coord);
	*p_similary = similary;
}
Пример #3
0
GridCoordPair MapMgr::GetTransformGridCoordPair(float x, float y)
{
    return GridCoordPair(GetGridCoord(y), GetGridCoord(x)); // yes, they are reversed. definitely.
}