Example #1
0
// -----------------------------------------------------------------
// Name : displayObjects
// -----------------------------------------------------------------
void Map::displayObjects(PlayerManager * pPlayerMngr)
{
    DisplayEngine * pDisplay = m_pTombGeometry->getDisplay();
    for (int x = 0; x < m_iWidth; x++)
    {
        for (int y = 0; y < m_iHeight; y++)
        {
            Coords3D pos3D = pDisplay->get3DCoords(CoordsMap(x, y), BOARDPLANE);
            MapObject * mapObj = m_pTiles[x][y]->getFirstMapObject(GOTYPE_TOWN);
            if (mapObj != NULL)
                mapObj->display();
            mapObj = m_pTiles[x][y]->getFirstMapObject(GOTYPE_TEMPLE);
            if (mapObj != NULL)
                mapObj->display();
            mapObj = m_pTiles[x][y]->getFirstMapObject(GOTYPE_DEAD_UNIT);
            if (mapObj != NULL)
                m_pTombGeometry->display(pos3D + Coords3D(0.6f, 0.1f), F_RGBA_NULL);
            mapObj = m_pTiles[x][y]->getFirstMapObject(GOTYPE_UNIT);
            if (mapObj != NULL)
            {
                mapObj->display();
                Player * pPlayer = pPlayerMngr->findPlayer(mapObj->getOwner());
                assert(pPlayer != NULL);
                pPlayer->m_pBannerGeometry->display(pos3D + Coords3D(0.7f, 0.0f), pPlayer->m_Color);
            }
            Player * pPlayer = pPlayerMngr->getActiveLocalPlayer();
            if (pPlayer != NULL)
            {
                if (m_pTiles[x][y]->m_pNbAlliesGeo != NULL)
                {
//          float fy = 0.31f;
                    if (m_pTiles[x][y]->m_pNbFoesGeo == NULL)
                    {
//            fy = 0.62f;
                        m_pCountUnitsBgGeometry1L->display(pos3D + Coords3D(-0.1f, 0.0f), F_RGBA_NULL);
                    }
                    else
                        m_pCountUnitsBgGeometry2L->display(pos3D + Coords3D(-0.1f, 0.0f), F_RGBA_NULL);
                    pPlayer->m_pBannerGeometry->display(pos3D + Coords3D(-0.1f, 0.0f), pPlayer->m_Color);
                    m_pTiles[x][y]->m_pNbAlliesGeo->display(pos3D + Coords3D(0.15f, 0.0f), F_RGBA_NULL);
                }
                if (m_pTiles[x][y]->m_pNbFoesGeo != NULL)
                {
                    float fy = 0.31f;
                    if (m_pTiles[x][y]->m_pNbAlliesGeo == NULL)
                    {
                        fy = 0.0f;
                        m_pCountUnitsBgGeometry1L->display(pos3D + Coords3D(-0.1f, 0.0f), F_RGBA_NULL);
                    }
                    m_pFoeBannerGeometry->display(pos3D + Coords3D(-0.1f, fy), rgb(0, 0, 0));
                    m_pTiles[x][y]->m_pNbFoesGeo->display(pos3D + Coords3D(0.15f, fy), F_RGBA_NULL);
                }
            }
        }
    }
}