|
|
@ -39,6 +39,25 @@ NLMISC_REGISTER_OBJECT(CViewBase, CViewRadar, std::string, "radar");
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CViewRadar::CViewRadar(const TCtorParam ¶m)
|
|
|
|
|
|
|
|
: CViewBase(param)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
|
|
|
|
CCDBNodeLeaf *pUIMI = pIM->getDbProp( "UI:SAVE:INSCENE:FRIEND:MISSION_ICON" );
|
|
|
|
|
|
|
|
if (pUIMI)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ICDBNode::CTextId textId;
|
|
|
|
|
|
|
|
pUIMI->addObserver( &_MissionIconsObs, textId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CCDBNodeLeaf *pUIMMI = pIM->getDbProp( "UI:SAVE:INSCENE:FRIEND:MINI_MISSION_ICON" );
|
|
|
|
|
|
|
|
if (pUIMMI)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ICDBNode::CTextId textId;
|
|
|
|
|
|
|
|
pUIMMI->addObserver( &_MiniMissionSpotsObs, textId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CViewRadar::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
|
|
|
bool CViewRadar::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CXMLAutoPtr prop;
|
|
|
|
CXMLAutoPtr prop;
|
|
|
@ -109,8 +128,9 @@ void CViewRadar::draw ()
|
|
|
|
|
|
|
|
|
|
|
|
CEntityCL *user = EntitiesMngr.entity(0);
|
|
|
|
CEntityCL *user = EntitiesMngr.entity(0);
|
|
|
|
if (user == NULL) return;
|
|
|
|
if (user == NULL) return;
|
|
|
|
|
|
|
|
|
|
|
|
CVectorD xyzRef = user->pos();
|
|
|
|
CVectorD xyzRef = user->pos();
|
|
|
|
CVector dir = user->front();
|
|
|
|
const CVector dir = user->front();
|
|
|
|
|
|
|
|
|
|
|
|
float angle = (float)(atan2(dir.y, dir.x) - (Pi / 2.0));
|
|
|
|
float angle = (float)(atan2(dir.y, dir.x) - (Pi / 2.0));
|
|
|
|
CMatrix mat;
|
|
|
|
CMatrix mat;
|
|
|
@ -124,9 +144,6 @@ void CViewRadar::draw ()
|
|
|
|
|
|
|
|
|
|
|
|
float maxSqrRadius= (float)sqr(_WorldSize/2);
|
|
|
|
float maxSqrRadius= (float)sqr(_WorldSize/2);
|
|
|
|
|
|
|
|
|
|
|
|
const bool displayMissionSpots = pIM->getDbProp("UI:SAVE:INSCENE:FRIEND:MISSION_ICON")->getValueBool();
|
|
|
|
|
|
|
|
const bool displayMiniMissionSpots = pIM->getDbProp("UI:SAVE:INSCENE:FRIEND:MINI_MISSION_ICON")->getValueBool();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (sint32 i = 1; i < 256; ++i)
|
|
|
|
for (sint32 i = 1; i < 256; ++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CEntityCL *entity = EntitiesMngr.entity(i);
|
|
|
|
CEntityCL *entity = EntitiesMngr.entity(i);
|
|
|
@ -161,7 +178,7 @@ void CViewRadar::draw ()
|
|
|
|
uint spotId = CNPCIconCache::getInstance().getNPCIcon(entity).getSpotId();
|
|
|
|
uint spotId = CNPCIconCache::getInstance().getNPCIcon(entity).getSpotId();
|
|
|
|
CRadarSpotDesc spotDesc = _SpotDescriptions[spotId];
|
|
|
|
CRadarSpotDesc spotDesc = _SpotDescriptions[spotId];
|
|
|
|
|
|
|
|
|
|
|
|
if (!displayMissionSpots)
|
|
|
|
if (!_MissionIconsObs._displayMissionSpots)
|
|
|
|
spotDesc = _SpotDescriptions[0];
|
|
|
|
spotDesc = _SpotDescriptions[0];
|
|
|
|
|
|
|
|
|
|
|
|
if (spotDesc.isMissionSpot)
|
|
|
|
if (spotDesc.isMissionSpot)
|
|
|
@ -171,7 +188,7 @@ void CViewRadar::draw ()
|
|
|
|
spotId = 4; // to make it over other spots
|
|
|
|
spotId = 4; // to make it over other spots
|
|
|
|
|
|
|
|
|
|
|
|
// Draw it (and make sure mission icons are drawn over regular dot; caution: don't exceed the render layer range)
|
|
|
|
// Draw it (and make sure mission icons are drawn over regular dot; caution: don't exceed the render layer range)
|
|
|
|
if (spotDesc.isMissionSpot && displayMiniMissionSpots)
|
|
|
|
if (spotDesc.isMissionSpot && _MiniMissionSpotsObs._displayMiniMissionSpots)
|
|
|
|
rVR.drawRotFlipBitmap (_RenderLayer+spotId, _XReal+x-(spotDesc.MTxW/2)+(_WReal/2), _YReal+y-(spotDesc.MTxH/2)+(_HReal/2),
|
|
|
|
rVR.drawRotFlipBitmap (_RenderLayer+spotId, _XReal+x-(spotDesc.MTxW/2)+(_WReal/2), _YReal+y-(spotDesc.MTxH/2)+(_HReal/2),
|
|
|
|
spotDesc.MTxW, spotDesc.MTxH, 0, false, spotDesc.MiniTextureId, col );
|
|
|
|
spotDesc.MTxW, spotDesc.MTxH, 0, false, spotDesc.MiniTextureId, col );
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -185,3 +202,13 @@ void CViewRadar::updateCoords()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CViewBase::updateCoords();
|
|
|
|
CViewBase::updateCoords();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CViewRadar::CDBMissionIconqObs::update(ICDBNode *node)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_displayMissionSpots = ((CCDBNodeLeaf*)node)->getValueBool();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CViewRadar::CDBMiniMissionSpotsObs::update(ICDBNode *node)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_displayMiniMissionSpots = ((CCDBNodeLeaf*)node)->getValueBool();
|
|
|
|
|
|
|
|
}
|
|
|
|