// ----------------------------------------------------------------- // 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); } } } } }
// ----------------------------------------------------------------- // Name : display // ----------------------------------------------------------------- void Map::display() { DisplayEngine * pDisplay = m_pEmptyMapGeometry->getDisplay(); Coords3D pos3D = pDisplay->get3DCoords(CoordsMap(0, 0), BOARDPLANE); m_pEmptyMapGeometry->display(pos3D, F_RGBA_NULL); CoordsMap screenTL = pDisplay->getMapCoords(CoordsScreen(0, 0)); CoordsMap screenBR = pDisplay->getMapCoords(CoordsScreen(pDisplay->getParameters()->screenXSize, pDisplay->getParameters()->screenYSize)); screenTL.x = 0;//max(0, screenTL.x); screenTL.y = 0;//max(0, screenTL.y); screenBR.x = m_iWidth - 1;//min(m_iWidth - 1, screenBR.x); screenBR.y = m_iHeight - 1;//min(m_iHeight - 1, screenBR.y); for (int x = screenTL.x; x <= screenBR.x; x++) { for (int y = screenTL.y; y <= screenBR.y; y++) m_pTiles[x][y]->display(CoordsMap(x, y)); } }