Anyone can give me the v15 minimap?
CWndNavigator::CWndNavigator()
{
m_bObjFilterPlayer = TRUE;
m_bObjFilterParty = TRUE;
m_bObjFilterNPC = TRUE;
m_bObjFilterMonster = TRUE;
m_szName[ 0 ] = 0;
m_iFrame = 0;
m_iPastTime = 0;
m_size.cx = 0;
m_size.cy = 0;
#if __VER >= 15 // __IMPROVE_QUEST_INTERFACE
m_pDestinationPositionTexture = NULL;
#endif // __IMPROVE_QUEST_INTERFACE
}
CWndNavigator::~CWndNavigator()
{
}
void CWndNavigator::SetRegionName( TCHAR *tszName )
{
CString strTitle = tszName;
if( strTitle.IsEmpty() )
strTitle = prj.GetText( TID_APP_NAVIGATOR );
SetTitle( strTitle );
}
BOOL CWndNavigator::OnEraseBkgnd(C2DRender* p2DRender)
{
if( g_pPlayer == NULL ) return TRUE;
LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice;
CWorld* pWorld = g_WorldMng();
CRect rect = GetClientRect();
// Æ÷Ä¿½º ¿ÀºêÁ§Æ® Ãâ·Â
CObj* pObjFocus = pWorld->GetObjFocus();
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
CLandscape* pLand = pWorld->GetLandscape( pWorld->m_pCamera->m_vPos );
if( pLand == NULL ) return 1;
int nImageBlock = pLand->m_texMiniMap.m_size.cx;
CRectClip clipRect( 0, 0, p2DRender->m_clipRect.Width(), p2DRender->m_clipRect.Height() );
CPoint point;
CRect rectCur;
FLOAT fx = (FLOAT)m_size.cx / ( MAP_SIZE * MPU );
FLOAT fy = (FLOAT)m_size.cy / ( MAP_SIZE * MPU );
D3DXVECTOR3 vPos, vCenter = ( g_pPlayer != NULL ? g_pPlayer->GetPos() : D3DXVECTOR3( 0, 0, 0 ) );
vCenter.x *= fx;
vCenter.z *= fy;
int xCenter = (int)( vCenter.x );
int yCenter = (int)( - vCenter.z );
int i;
BOOL bDrawGuildWarNum = FALSE;
DWORD dwWorldID = pWorld->GetID();
if( dwWorldID == WI_WORLD_GUILDWAR )
bDrawGuildWarNum = TRUE;
for( int z = 0; z < pWorld->m_nLandHeight; z++ )
{
for( int x = 0; x < pWorld->m_nLandWidth; x++ )
{
point = CPoint ( x * nImageBlock, z * nImageBlock );
point.y -= ( nImageBlock * pWorld->m_nLandWidth );
point.x += rect.Width() / 2;
point.y += rect.Height() / 2;
point.x -= xCenter;
point.y -= yCenter;
rectCur.SetRect( point.x, point.y, point.x + nImageBlock, point.y + nImageBlock );
CLandscape* pLand = pWorld->GetLandscape( x, pWorld->m_nLandHeight - z - 1);
if( pLand )
{
pLand->m_texMiniMap.m_size = m_size;
if( clipRect.RectLapRect( rectCur ) )
{
if( pLand->m_texMiniMap.m_pTexture )
{
// pLand->m_texMiniMap.m_size = m_size;
pLand->m_texMiniMap.Render( p2DRender, point, 200 );//CWndBase::m_nAlpha );
if( bDrawGuildWarNum )
{
m_GuildCombatTextureMask.m_size = pLand->m_texMiniMap.m_size;
m_GuildCombatTextureMask.Render( p2DRender, point, 200 );
}
}
}
}
}
}
AccuFrame(); // °£´ÜÇÑ ÇÁ·¹ÀÓ °è»êÀ» ÇØÁØ´Ù.
if( pWorld->m_bIsIndoor == FALSE
#if __VER >= 15 // __15TH_INSTANCE_DUNGEON
&& !pWorld->IsWorldInstanceDungeon()
#endif // __15TH_INSTANCE_DUNGEON
)
{
// °´Ã¼ Ãâ·ÂÀ» À§ÇÑ ¼³Á¤
TEXTUREVERTEX vertex[ 1000 * 6 ];
TEXTUREVERTEX* pVertices = vertex;
int nCount = 0;
int xu = 0, yv = 0;
CRect aRcArray[ 100 ];
int nRcCount = 0;
////////////////////////////////////////////////////
// ¿ÀºêÁ§Æ® Ãâ·Â
////////////////////////////////////////////////////
CObj* pObj;
int nIndex = 0;
int nPartyMap[ MAX_PTMEMBER_SIZE ];
CMover* apQuest[ 100 ];
int nQuestNum = 0;
ZeroMemory( nPartyMap, sizeof(nPartyMap) );
int nPartyMapCount = 0;
float fDistMap = rect.Width() / 2 / fx;
FOR_LAND( pWorld, pLand, pWorld->m_nVisibilityLand, FALSE )
{
FOR_OBJ( pLand, pObj, OT_MOVER )
{
// BOOL bPartyMap = FALSE;
if( pObj != g_pPlayer )
{
CMover* pMover = (CMover*)pObj;
if( g_pPlayer->m_idMurderer != pMover->m_idPlayer ) // ÂïÀ» Ÿ°ÙÀÌ ³¯ Á×ÀγÑÀ̸é Á¶°Ç¾øÀÌ ¹«Á¶°Ç Âï´Â´Ù.
{
// Ç÷¹À̾îÇÊÅͰ¡ ¾Æ´Ñµ¥, Ç÷¹À̾î¶ó¸é
if( m_bObjFilterPlayer == FALSE && pMover->IsPlayer() == TRUE )
{
// °Ô´Ù°¡ ÆÄƼÇÊÅ͵µ ¾Æ´Ï¶ó¸é ½ºÅµ
if( m_bObjFilterParty == FALSE )
continue;
if( g_Party.IsMember( pMover->m_idPlayer ) == FALSE )
continue;
}
if( m_bObjFilterMonster == FALSE && ( pMover->IsPlayer() == FALSE && pMover->IsPeaceful() == FALSE ) )
continue;
if( m_bObjFilterNPC == FALSE && ( pMover->IsPlayer() == FALSE && pMover->IsPeaceful() == TRUE ) )
{
// »óÁ¡ÀÌ ¾Æ´Ï¶ó¸é ÄÁƼ´º.
LPCHARACTER lpCharacter = pMover->GetCharacter();
if( lpCharacter == NULL || lpCharacter->m_nStructure == -1 )
continue;
}
if( pMover->IsMode( TRANSPARENT_MODE ) || pMover->IsAuthHigher( AUTH_GAMEMASTER ) ) // ´ë»óÀÌ Åõ¸í¸ðµåÀ̰ųª GMÀϰæ¿ì Ÿ°Ù ¾ÈµÊ.
continue;
}
vPos = pObj->GetPos();
vPos.x *= fx;
vPos.z *= fy;
point.x = (LONG)( ( rect.Width() / 2 ) + vPos.x );
point.y = (LONG)( ( rect.Height() / 2 ) - vPos.z );
point.x -= xCenter;
point.y -= yCenter;
CRect rectHittest( point.x, point.y, point.x + 5, point.y + 5);
//rectHittest.InflateRect( 4, 4 );
CPoint ptMouse = GetMousePoint();
if( rectHittest.PtInRect( ptMouse ) )
{
ClientToScreen( &ptMouse );
ClientToScreen( &rectHittest );
g_toolTip.PutToolTip( 10000 + ((CMover*)pObj)->GetId(), ((CMover*)pObj)->GetName( TRUE ), rectHittest, ptMouse, 0 );
}
// Äù½ºÆ® À̸ðƼÄÜ
if( pMover->IsNPC() && pMover->m_nQuestEmoticonIndex != -1 )
{
apQuest[ nQuestNum++ ] = pMover;
}
else
if( g_pPlayer->m_idMurderer && g_pPlayer->m_idMurderer == pMover->m_idPlayer ) // ÂïÀ» Ÿ°ÙÀÌ ³¯ Á×ÀγÑÀÌ¸é »¡°²°Ô Ç¥½Ã
nIndex = 5;
else
if( pMover->IsNPC() && pMover->IsPeaceful() )
{
nIndex = 1;
}
else
if( g_pPlayer->m_idGuild && g_pPlayer->m_idGuild == pMover->m_idGuild )
nIndex = 3;
else
if( pMover->IsNPC() && pMover->IsPeaceful() == FALSE )
nIndex = 2;
//xu = 10, yv = 0;
else
if( pMover->IsPlayer() )
{
nPartyMap[nPartyMapCount] = g_Party.FindMember( pMover->m_idPlayer );
if( nPartyMap[nPartyMapCount] != -1 )
{
g_Party.m_aMember[ nPartyMap[nPartyMapCount] ].m_vPos = pMover->GetPos();
++nPartyMapCount;
nIndex = 4;
}
else
nIndex = 0;
}
if( nCount < 1000 )
{
nCount++;
LPCHARACTER lpCharacter = pMover->GetCharacter();
if( lpCharacter && lpCharacter->m_nStructure != -1 )
m_texNavObjs.MakeVertex( p2DRender, CPoint( point.x - 8, point.y - 8 ), 6 + lpCharacter->m_nStructure, &pVertices );
else
{
// Äù½ºÆ®°¡ ¾ø´Â °Í¸¸ Ãâ·Â
if( pMover->m_nQuestEmoticonIndex == -1 )
m_texNavObjs.MakeVertex( p2DRender, CPoint( point.x - 2, point.y - 2 ), nIndex, &pVertices );
}
}
}
}
END_OBJ
}
END_LAND
////////////////////////////////////////////////////////
// ¸®Á¯ ¿ÀºêÁ§Æ®·Î ¼³Á¤µÈ ½ºÆ®·°ÃÄ À̸ðƼÄÜ Ãâ·Â
////////////////////////////////////////////////////////
int nSize = pWorld->m_aStructure.GetSize();
for( i = 0; i < nSize; i++ )
{
LPREGIONELEM lpRegionElem = pWorld->m_aStructure.GetAt( i );
vPos = lpRegionElem->m_vPos;
vPos.x *= fx;
vPos.z *= fy;
point.x = (LONG)( ( rect.Width() / 2 ) + vPos.x );
point.y = (LONG)( ( rect.Height() / 2 ) - vPos.z );
point.x -= xCenter;
point.y -= yCenter;
m_texNavObjs.MakeVertex( p2DRender, CPoint( point.x - 8, point.y - 8 ), 6 + lpRegionElem->m_dwStructure, &pVertices );
}
////////////////////////////////////////////////////////
// Äù½ºÆ® À̸ðƼÄÜ Ãâ·Â
// ¸ðµç ¾ÆÀÌÄÜ º¸´Ù ¸Ç À§¿¡ ÂïÇô¾ß µÇ¹Ç·Î ¿©°¡¼* ¸ô¾Æ¼* Âï´Â´Ù.
////////////////////////////////////////////////////////
for( i = 0; i < nQuestNum; i++ )
{
CMover* pMover = apQuest[ i ];
vPos = pMover->GetPos();
vPos.x *= fx;
vPos.z *= fy;
point.x = (LONG)( ( rect.Width() / 2 ) + vPos.x );
point.y = (LONG)( ( rect.Height() / 2 ) - vPos.z );
point.x -= xCenter;
point.y -= yCenter;
nIndex = pMover->m_nQuestEmoticonIndex + 20;
m_texNavObjs.MakeVertex( p2DRender, CPoint( point.x - 5, point.y - 5 ), nIndex, &pVertices );
/*
LPCHARACTER lpCharacter = pMover->GetCharacter();
if( pMover->m_nQuestEmoticonIndex == 0 || pMover->m_nQuestEmoticonIndex == 2 )
{
if( lpCharacter && lpCharacter->m_nStructure == -1 )
{
nIndex = pMover->m_nQuestEmoticonIndex + 20;
m_texNavObjs.MakeVertex( p2DRender, CPoint( point.x - 5, point.y - 5 ), nIndex, &pVertices );
}
}
else
if( pMover->m_nQuestEmoticonIndex == 1 || pMover->m_nQuestEmoticonIndex == 3 )
{
//if( lpCharacter && lpCharacter->m_nStructure != -1 )
{
nIndex = pMover->m_nQuestEmoticonIndex + 20;
m_texNavObjs.MakeVertex( p2DRender, CPoint( point.x - 5, point.y - 5 ), nIndex, &pVertices );
}
}
*/
}
/* #ifdef __S1005_PARTY_MAP
nPartyMap[nPartyMapCount] = g_Party.FindMember( g_pPlayer->m_idPlayer );
if( nPartyMap[nPartyMapCount] != -1 )
++nPartyMapCount;
for( i = 0 ; i < g_Party.GetSizeofMember() && g_Party.GetSizeofMember() != nPartyMapCount ; ++i )
{
BOOL bDisplay = TRUE;
for( int j = 0 ; j < nPartyMapCount ; ++j )
{
if( nPartyMap[j] == i )
{
bDisplay = FALSE;
break;
}
}
if( bDisplay )
{
D3DXVECTOR3 vPosBuf = g_pPlayer->GetPos() - g_Party.GetPos( i );
float fDist = D3DXVec3Length( &vPosBuf );
if( fDist > fDistMap )
{
RenderPartyMember( p2DRender, &pVertices, rect, g_Party.GetPos( i ), g_Party.m_aMember[i].m_uPlayerId, g_Party.m_aMember[i].m_szName );
}
else
{
vPos = g_Party.GetPos( i );
vPos.x *= fx;
vPos.z *= fy;
point.x = ( rect.Width() / 2 ) + vPos.x;
point.y = ( rect.Height() / 2 ) - vPos.z;
point.x -= xCenter;
point.y -= yCenter;
m_texNavObjs.MakeVertex( p2DRender, CPoint( point.x - 2, point.y - 2 ), 3, &pVertices );
CRect rectHittest( point.x, point.y, point.x + 5, point.y + 5);
CPoint ptMouse = GetMousePoint();
if( rectHittest.PtInRect( ptMouse ) )
{
ClientToScreen( &ptMouse );
ClientToScreen( &rectHittest );
g_toolTip.PutToolTip( 10000 + g_Party.m_aMember[i].m_uPlayerId, g_Party.m_aMember[i].m_szName, rectHittest, ptMouse, 0 );
}
}
}
}
#endif // __S1005_PARTY_MAP
*/
////////////////////////////////////////////////////
// Æ÷Ä¿½º ¿ÀºêÁ§Æ® Ãâ·Â (Á»´õ ºÐ¸êÇÏ°Ô º¸À̵µ·Ï)
////////////////////////////////////////////////////
if( pObjFocus )
{
vPos = pObjFocus->GetPos();
vPos.x *= fx;
vPos.z *= fy;
point.x = (LONG)( ( rect.Width() / 2 ) + vPos.x );
point.y = (LONG)( ( rect.Height() / 2 ) - vPos.z );
point.x -= xCenter;
point.y -= yCenter;
xu = 9, yv = 9;
point.x -= 3;
point.y -= 3;
if( nCount < 1000 )
{
nCount++;
m_texNavObjs.MakeVertex( p2DRender, point, 5, &pVertices );
}
}
m_texNavObjs.Render( m_pApp->m_pd3dDevice, vertex, ( (int) pVertices - (int) vertex ) / sizeof( TEXTUREVERTEX ) );
#if __VER >= 15 // __IMPROVE_QUEST_INTERFACE
D3DXVECTOR3& rDestinationArrow = g_WndMng.m_pWndWorld->m_vDestinationArrow;
if( rDestinationArrow != D3DXVECTOR3( -1.0F, 0.0F, -1.0F ) )
{
vPos = rDestinationArrow;
vPos.x *= fx;
vPos.z *= fy;
point.x = (LONG)( ( rect.Width() / 2 ) + vPos.x );
point.y = (LONG)( ( rect.Height() / 2 ) - vPos.z );
point.x -= xCenter;
point.y -= yCenter;
xu = 9, yv = 9;
point.x -= 3;
point.y -= 3;
m_pDestinationPositionTexture->RenderScal( p2DRender, point, 255, 0.4F, 0.4F );
}
#endif // __IMPROVE_QUEST_INTERFACE
}
else
{
m_texDunFog.m_size = CSize( rect.Width(), rect.Height() );
p2DRender->RenderTexture( CPoint( 0, 0 ), &m_texDunFog, 255 );
}
m_wndPlace.EnableWindow( !pWorld->m_bIsIndoor );
RenderMarkAll(p2DRender, g_pPlayer);
// È*¸é ºñÀ² ¶§¹®¿¡ ÀÓÀÇ·Î Á¤»ç°¢Çü ºäÆ÷Æ®¸¦ ÁöÁ¤ÇØ ³õ´Â´Ù. ¾È±×·¯¸é È*»ìÇ¥ ¸ð¾çÀÌ Âî±×·¯Áü.
D3DVIEWPORT9 viewport;
viewport.X = p2DRender->m_clipRect.left + ( p2DRender->m_clipRect.Width() / 2 );
viewport.Y = p2DRender->m_clipRect.top + ( p2DRender->m_clipRect.Height() / 2 );
viewport.Width = 32;
viewport.Height = 32;
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
viewport.X -= 16;
viewport.Y -= 16;
pd3dDevice->SetViewport( &viewport );
// ÇÁ·ÎÁ§¼Ç
D3DXMATRIX matProj;
D3DXMatrixIdentity( &matProj );
pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
// Ä«¸Þ¶ó
D3DXMATRIX matView;
D3DXMatrixIdentity( &matView );
pd3dDevice->SetTransform( D3DTS_VIEW, &matView );
D3DXMATRIX mat, matWorld;
D3DXMatrixIdentity( &matWorld );
D3DXMatrixScaling( &mat, 1.2f, 1.2f, 1.2f );
D3DXMatrixMultiply( &matWorld, &matWorld, &mat );
/*
FLOAT fAngle = ( g_pPlayer != NULL ? g_pPlayer->GetAngle() - 180 : 0 );
if( fAngle < 0 ) fAngle = 360 + fAngle;
FLOAT fTheta = D3DXToRadian( fAngle );// (2*D3DX_PI*g_pPlayer->m_nAngle)/(360);//m_nAngle
D3DXMatrixRotationZ( &mat, fTheta );
*/
D3DXVECTOR3 vDir = D3DXVECTOR3( 0.0f, 0.0f, 1.0f );
D3DXVECTOR3 vDestNor = g_pPlayer->GetPos() - g_Neuz.m_camera.m_vPos;
D3DXVECTOR3 vAxis;
D3DXQUATERNION qRot;
FLOAT fTheta;
D3DXVec3Normalize( &vDestNor, &vDestNor );
D3DXVec3Cross( &vAxis, &vDir, &vDestNor );
fTheta = D3DXVec3Dot( &vDir, &vDestNor );
D3DXQuaternionRotationAxis( &qRot, &vAxis, acosf( fTheta ) );
D3DXVECTOR3 vYPW;
QuaternionRotationToYPW( qRot, vYPW );
D3DXMatrixRotationZ( &mat, -(vYPW.y) );
D3DXMatrixMultiply( &matWorld, &matWorld, &mat );
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
// È*»ìÇ¥ Ãâ·Â
m_billArrow.Render( pd3dDevice );
return TRUE;
}
void CWndNavigator::RenderMark( C2DRender* p2DRender, CMover* Player )
{
FLOAT fx = (FLOAT)m_size.cx / ( MAP_SIZE * MPU );
FLOAT fy = (FLOAT)m_size.cy / ( MAP_SIZE * MPU );
if ( Player->m_nvPoint.Time != 0 )
{
D3DXVECTOR3 Pos = g_pPlayer->GetPos() - Player->m_nvPoint.Pos;
Pos.x *= fx ;
Pos.z *= -fy;
Player->m_nvPoint.Time--;
CPoint point;
CRect rect = GetClientRect();
point.x = (LONG)( ( rect.Width() / 2 ) - ( Pos.x + 2 ) );
point.y = (LONG)( ( rect.Height() / 2 ) - ( Pos.z + 2 ) );
//m_texNavPos.MakeVertex(p2DRender, point, 1, &pVertices);
m_texNavPos.Render( p2DRender, point, m_iFrame, 255, 0.5f, 0.5f);
CRect rectHit( point.x - 8, point.y - 8, point.x + 8, point.y + 8);
CPoint ptMouse = GetMousePoint();
if( rectHit.PtInRect( ptMouse ) )
{
// CString toolTip("Mark : ");
CString toolTip = prj.GetText( TID_GAME_NAV_MARK );
toolTip += Player->GetName( TRUE );
ClientToScreen( &ptMouse );
ClientToScreen( &rectHit );
g_toolTip.PutToolTip( 10000 + Player->GetId(), toolTip, rectHit, ptMouse, 0 );
}
}
}
// ÀÌ°É ³Ö¾î ÁØ´ÙÀ½¿¡ Á¤¸®¸¦ À§Çؼ* NaviPointÇüÀ» ÂüÁ¶³ª Æ÷ÀÎÅÍ·Î ¹Þ´Â ÇüÅ·Π´Ù½Ã ¸¸µé¾î ÁÖ¾î¾ß ÇÒ°ÍÀÌ´Ù.
void CWndNavigator::RenderMarkAll( C2DRender* p2DRender , CMover * Player )
{
RenderMark( p2DRender, Player );
FLOAT fx = (FLOAT)m_size.cx / ( MAP_SIZE * MPU );
FLOAT fy = (FLOAT)m_size.cy / ( MAP_SIZE * MPU );
V_NaviPoint::iterator nvi = g_pPlayer->m_vOtherPoint.begin();
for ( int i = 0 ; i < (int)( g_pPlayer->m_vOtherPoint.size() ) ; )
{
if ( g_pPlayer->m_vOtherPoint[i].Time != 0 )
{
D3DXVECTOR3 Pos = g_pPlayer->GetPos() - g_pPlayer->m_vOtherPoint[i].Pos;
Pos.x *= fx ;
Pos.z *= -fy;
g_pPlayer->m_vOtherPoint[i].Time--;
CPoint point;
CRect rect = GetClientRect();
point.x = (LONG)( ( rect.Width() / 2 ) - ( Pos.x + 2 ) );
point.y = (LONG)( ( rect.Height() / 2 ) - ( Pos.z + 2 ) );
//m_texNavPos.MakeVertex(p2DRender, point, 1, &pVertices);
m_texNavPos.Render( p2DRender, point, m_iFrame, 255, 0.5f, 0.5f);
CRect rectHit( point.x - 8, point.y - 8, point.x + 8, point.y + 8);
CPoint ptMouse = GetMousePoint();
if( rectHit.PtInRect( ptMouse ) )
{
// CString toolTip("Mark : ");
CString toolTip = prj.GetText( TID_GAME_NAV_MARK );
toolTip += g_pPlayer->m_vOtherPoint[i].Name.c_str();
ClientToScreen( &ptMouse );
ClientToScreen( &rectHit );
g_toolTip.PutToolTip( 10000 + g_pPlayer->m_vOtherPoint[i].objid, toolTip, rectHit, ptMouse, 0 );
}
nvi++;
i++;
}
else
{
g_pPlayer->m_vOtherPoint.erase(nvi);
}
}
}
void CWndNavigator::RenderPartyMember( C2DRender* p2DRender, TEXTUREVERTEX** pVertices, CRect rect, D3DXVECTOR3 vPos, u_long uIdPlayer, LPCTSTR lpStr )
{
float fDistx = g_pPlayer->GetPos().x - vPos.x;
float fDistz = g_pPlayer->GetPos().z - vPos.z;
float fRadian = atan2( fDistx, fDistz );
float fDegree = D3DXToDegree( fRadian );
CPoint PointBuf;
if( fDegree < 0 )
{
if( fDegree > -45 )
PointBuf = CPoint( (int)( rect.Width() / 2 + -fDegree ), rect.Height() - 10 );
else if( fDegree > -135 )
PointBuf = CPoint( rect.Width() - 10, (int)( rect.Height() / 2 + 90 + fDegree ) );
else
PointBuf = CPoint( (int)( rect.Width() / 2 + (180 + fDegree) ), 5 );
}
else
{
if( fDegree < 45 )
PointBuf = CPoint( (int)( rect.Width() / 2 + -fDegree ), rect.Height() - 10 );
else if( fDegree < 135 )
PointBuf = CPoint( 8, (int)( rect.Height() / 2 + 90 -fDegree ) );
else
PointBuf = CPoint( (int)( rect.Width() / 2 + -(180 - fDegree) ), 5 );
}
m_texNavObjs.MakeVertex( p2DRender, PointBuf, 3, pVertices );
CRect rectHittest( PointBuf.x, PointBuf.y, PointBuf.x + 5, PointBuf.y + 5);
CPoint ptMouse = GetMousePoint();
if( rectHittest.PtInRect( ptMouse ) )
{
ClientToScreen( &ptMouse );
ClientToScreen( &rectHittest );
g_toolTip.PutToolTip( 10000 + uIdPlayer, lpStr, rectHittest, ptMouse, 0 );
}
}
HRESULT CWndNavigator::DeleteDeviceObjects()
{
//CWndNeuz::DeleteDeviceObjects();
m_texArrow.DeleteDeviceObjects();
m_texNavObjs.DeleteDeviceObjects();
m_billArrow.DeleteDeviceObjects();
m_texNavPos.DeleteDeviceObjects();
m_GuildCombatTextureMask.DeleteDeviceObjects();
#ifdef __YDEBUG
m_texDunFog.DeleteDeviceObjects();
#endif //__YDEBUG
return CWndNeuz::DeleteDeviceObjects();
}
HRESULT CWndNavigator::InvalidateDeviceObjects()
{
m_texNavPos.InvalidateDeviceObjects();
m_GuildCombatTextureMask.Invalidate();
#ifdef __YDEBUG
m_texArrow.Invalidate();
m_texDunFog.Invalidate();
m_texNavObjs.InvalidateDeviceObjects();
#endif //__YDEBUG
m_billArrow.InvalidateDeviceObjects();
return CWndNeuz::InvalidateDeviceObjects();
}
HRESULT CWndNavigator::RestoreDeviceObjects()
{
m_texNavPos.RestoreDeviceObjects( m_pApp->m_pd3dDevice );
m_GuildCombatTextureMask.SetInvalidate(m_pApp->m_pd3dDevice);
#ifdef __YDEBUG
m_texArrow.SetInvalidate(m_pApp->m_pd3dDevice);
m_texDunFog.SetInvalidate(m_pApp->m_pd3dDevice);
m_texNavObjs.RestoreDeviceObjects(m_pApp->m_pd3dDevice);
#endif //__YDEBUG
ResizeMiniMap();
m_billArrow.RestoreDeviceObjects();
return CWndNeuz::RestoreDeviceObjects();
}
void CWndNavigator::OnDraw(C2DRender* p2DRender)
{
#if __VER >= 13 // __RAINBOW_RACE
// Rainbow Race Time Ãâ·Â
DWORD dwRainbowRaceTime = CRainbowRace::GetInstance()->m_dwRemainTime;
if(dwRainbowRaceTime > 0)
{
char szMsg[256] = { 0 };
CTimeSpan ct( (dwRainbowRaceTime - GetTickCount()) / 1000 );
sprintf( szMsg, "%.2d:%.2d:%.2d", ct.GetHours(), ct.GetMinutes(), ct.GetSeconds() );
CRect rectWindow = GetClientRect();
p2DRender->TextOut(rectWindow.right - 50, rectWindow.bottom - 16, szMsg, 0xffffff00);
}
#endif //__RAINBOW_RACE
}
void CWndNavigator::SerializeRegInfo( CAr& ar, DWORD& dwVersion )
{
CWndNeuz::SerializeRegInfo( ar, dwVersion );
if( ar.IsLoading() )
{
if( dwVersion == 0 )
{
ar >> m_bObjFilterPlayer >> m_bObjFilterParty >> m_bObjFilterNPC >> m_bObjFilterMonster;
}
else
{
ar >> m_bObjFilterPlayer >> m_bObjFilterParty >> m_bObjFilterNPC >> m_bObjFilterMonster;
ar >> m_size.cx >> m_size.cy;
}
m_wndMenuPlace.CheckMenuItem( 0, m_bObjFilterPlayer );
m_wndMenuPlace.CheckMenuItem( 1, m_bObjFilterParty );
m_wndMenuPlace.CheckMenuItem( 2, m_bObjFilterNPC );
m_wndMenuPlace.CheckMenuItem( 3, m_bObjFilterMonster );
}
else
{
dwVersion = 1;
ar << m_bObjFilterPlayer << m_bObjFilterParty << m_bObjFilterNPC << m_bObjFilterMonster;
ar << m_size.cx << m_size.cy;
}
}
void CWndNavigator::OnInitialUpdate()
{
CWndNeuz::OnInitialUpdate();
CRect rectClient = GetClientRect();
rectClient.right = 13;
m_wndPlace.Create ( "P", 0, CRect( rectClient.left, 1, rectClient.left + 16, 1 + 16 ), this, 100000 );
// m_wndMover.Create ( "U", 0, CRect( rectClient.left, 17, rectClient.left + 16, 17 + 16 ), this, 100001 );
// m_wndMover.Create ( "M", 0, CRect( rectClient.left, 36, rectClient.left + 16, 36 + 16 ), this, 102 );
m_wndZoomIn.Create ( "+", 0, CRect( rectClient.left, 54, rectClient.left + 16, 54 + 16 ), this, 100005 );
m_wndZoomOut.Create( "-", 0, CRect( rectClient.left, 70, rectClient.left + 16, 70 + 16 ), this, 100006 );
m_wndPlace.SetTexture( D3DDEVICE, MakePath( DIR_THEME, "ButtNavLeft.tga" ), TRUE );
m_wndPlace.FitTextureSize();
m_wndZoomIn.SetTexture( D3DDEVICE, MakePath( DIR_THEME, "ButtNavZoomIn.tga" ), TRUE );
m_wndZoomIn.FitTextureSize();
m_wndZoomOut.SetTexture( D3DDEVICE, MakePath( DIR_THEME, "ButtNavZoomOut.tga" ), TRUE );
m_wndZoomOut.FitTextureSize();
m_texDunFog.LoadTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_THEME, "NavDunFog.tga" ), 0 , 1 );
#if __VER >= 15 // __IMPROVE_QUEST_INTERFACE
m_pDestinationPositionTexture = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_THEME, "ButtDestination.bmp"), 0xffff00ff );
#endif // __IMPROVE_QUEST_INTERFACE
m_wndMenuPlace.CreateMenu( this );
/*
m_wndMenuPlace.AppendMenu( 0, 0 ,_T("Ç÷¹À̾î" ) );
m_wndMenuPlace.AppendMenu( 0, 1 ,_T("±Ø´Ü" ) );
m_wndMenuPlace.AppendMenu( 0, 2 ,_T("NPC" ) );
m_wndMenuPlace.AppendMenu( 0, 3 ,_T("¸ó½ºÅÍ" ) );
*/
m_wndMenuPlace.AppendMenu( 0, 0 , prj.GetText(TID_GAME_PLAYER) );
m_wndMenuPlace.AppendMenu( 0, 1 , prj.GetText(TID_GAME_PARTYTEXT) );
m_wndMenuPlace.AppendMenu( 0, 2 , prj.GetText(TID_GAME_NPC) );
m_wndMenuPlace.AppendMenu( 0, 3 , prj.GetText(TID_GAME_MONSTER) );
m_wndMenuPlace.CheckMenuItem( 0, m_bObjFilterPlayer );
m_wndMenuPlace.CheckMenuItem( 1, m_bObjFilterParty );
m_wndMenuPlace.CheckMenuItem( 2, m_bObjFilterNPC );
m_wndMenuPlace.CheckMenuItem( 3, m_bObjFilterMonster );
/*
m_wndMenuPlace.AppendMenu( 0, 0 ,_T("¹«±â»óÁ¡" ) );
m_wndMenuPlace.AppendMenu( 0, 1 ,_T("ÀâÈ*Á¡" ) );
m_wndMenuPlace.AppendMenu( 0, 2 ,_T("¹æ¾î±¸Á¡" ) );
m_wndMenuPlace.AppendMenu( 0, 3 ,_T("¼úÁý" ) );
m_wndMenuPlace.AppendMenu( 0, 4 ,_T("µµ½Ã " ) );
m_wndMenuPlace.AppendMenu( 0, 5 ,_T("¹«±â»óÁ¡" ) );
m_wndMenuPlace.AppendMenu( 0, 6 ,_T("ÀâÈ*Á¡" ) );
m_wndMenuPlace.AppendMenu( 0, 7 ,_T("¹æ¾î±¸Á¡" ) );
m_wndMenuPlace.AppendMenu( 0, 8 ,_T("¼úÁý" ) );
m_wndMenuPlace.AppendMenu( 0, 9 ,_T("-- Àå¼ÒÃß°¡ --" ));
*/
m_wndMenuMover.CreateMenu( this );
/*
CRect rect = GetClientRect();
D3DXVECTOR3 vPos = ( g_pPlayer != NULL ? g_pPlayer->GetPos() : D3DXVECTOR3( 0, 0 , 0 ) );
// 128 : m_texture.m_size.cx = 1 : x
FLOAT fx = (FLOAT)m_texture.m_size.cx / 256.0f * 2;
FLOAT fy = (FLOAT)m_texture.m_size.cy / 256.0f * 2;
vPos.x *= fx;
vPos.z *= fy;
CObj* pObj;
D3DXVECTOR3 vCenter = ( g_pPlayer != NULL ? g_pPlayer->GetPos() : D3DXVECTOR3( 0, 0, 0 ) );
*/
//m_size = CSize( MINIMAP_SIZE, MINIMAP_SIZE );
m_size = CSize( 256, 256) ;//MINIMAP_SIZE, MINIMAP_SIZE );
m_nSizeCnt = 0;
//m_wndMinimize.Create("_",0,CRect(00,0,14,14),this,10000);
CRect rectRoot = m_pWndRoot->GetLayoutRect();
CRect rectWindow = GetWindowRect();
CPoint point( rectRoot.right - rectWindow.Width(), rectRoot.top );
Move( point );
ResizeMiniMap();
}
BOOL CWndNavigator::Initialize(CWndBase* pWndParent,DWORD dwWndId)
{
CRect rectWindow = m_pWndRoot->GetWindowRect();
CRect rect( 0, 0, 115, 110 ); // 1024 768
m_texNavObjs.LoadScript( g_Neuz.m_pd3dDevice, MakePath( DIR_THEME,"Navigator.inc") );
m_texArrow.LoadTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_THEME,"ImgNavArrow.bmp"), 0xffff00ff );
m_texNavPos.LoadScript( g_Neuz.m_pd3dDevice, MakePath( DIR_THEME, "NavPosition.inc") );
ZeroMemory( &m_billboard, sizeof( m_billboard ) );
m_billboard.rect.SetRect( 0, 0, m_texArrow.m_size.cx, m_texArrow.m_size.cy );
m_billboard.ptCenter = CPoint( m_texArrow.m_size.cx / 2, m_texArrow.m_size.cy / 2 );
m_billArrow.InitDeviceObjects( g_Neuz.m_pd3dDevice, &m_billboard, &m_texArrow );
m_billArrow.RestoreDeviceObjects();
m_GuildCombatTextureMask.LoadTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_WORLD_GUILDCOMBAT, "WdGuildWar_Mask.dds" ), 0 );
SetTitle( GETTEXT( TID_APP_NAVIGATOR ) );
return CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), dwWndId, 0, CPoint( 792, 130 ), pWndParent );
// return CWndNeuz::Create( WBS_MOVE|WBS_SOUND|WBS_CAPTION, rect, &g_WndMng, dwWndId );
}
void CWndNavigator::ResizeMiniMap()
{
CWorld* pWorld = g_WorldMng();
if( pWorld == NULL )
return;
for( int z = 0; z < pWorld->m_nLandHeight; z++ )
{
for( int x = 0; x < pWorld->m_nLandWidth; x++ )
{
CLandscape* pLand = pWorld->GetLandscape( x, pWorld->m_nLandHeight - z - 1);
if( pLand )
pLand->m_texMiniMap.m_size = m_size;
}
}
}
BOOL CWndNavigator::OnChildNotify(UINT message,UINT nID,LRESULT* pLResult)
{
CRect rect = GetWindowRect( TRUE );
//int nImageBlock = pLand->m_texMiniMap.m_size.cx;
CWndBase* pWndBase = (CWndBase*) pLResult;
if( pWndBase->m_pParentWnd == &m_wndMenuPlace )
{
// g_WndMng.m_nObjectFilter = nID;
//m_wndMenuPlace.CheckMenuRadioItem( 0, 2, nID, TRUE );
int nState = !m_wndMenuPlace.GetMenuState( nID, 0 );
m_wndMenuPlace.CheckMenuItem( nID, nState );
SetFocus();
switch( nID )
{
case OBJFILTER_PLAYER:
m_bObjFilterPlayer = nState;
break;
case OBJFILTER_PARTY:
m_bObjFilterParty = nState;
break;
case OBJFILTER_NPC:
m_bObjFilterNPC = nState;
break;
case OBJFILTER_MONSTER:
m_bObjFilterMonster = nState;
break;
}
}
else
if( message == WNM_CLICKED )
{
switch(nID)
{
case 100000: // Àå¼Ò ã±â
#if __VER >= 15 // __IMPROVE_SYSTEM_VER15
{
CRect rectRootLayout = m_pWndRoot->GetLayoutRect();
int nMenuPlaceLeft = rect.left - m_wndMenuPlace.GetWindowRect().Width();
if( nMenuPlaceLeft < rectRootLayout.left )
m_wndMenuPlace.Move( CPoint( rect.right, rect.top ) );
else
m_wndMenuPlace.Move( CPoint( nMenuPlaceLeft, rect.top ) );
m_wndMenuPlace.SetVisible( !m_wndMenuPlace.IsVisible() );
m_wndMenuPlace.SetFocus();
}
#else // __IMPROVE_SYSTEM_VER15
m_wndMenuPlace.Move( CPoint( rect.left - m_wndMenuPlace.GetWindowRect().Width(), rect.top ) );
m_wndMenuPlace.SetVisible( !m_wndMenuPlace.IsVisible() );
m_wndMenuPlace.SetFocus();
#endif // __IMPROVE_SYSTEM_VER15
break;
case 100001: // Àå¼Ò ã±â
{
m_wndMenuMover.DeleteAllMenu();
CWorld* pWorld = g_WorldMng();
CLandscape* pLand;
CObj* pObj;
CWndButton* pWndButton;
int i = 0;
FOR_LAND( pWorld, pLand, pWorld->m_nVisibilityLand, FALSE )
{
FOR_OBJ( pLand, pObj, OT_MOVER )
{
pWndButton = m_wndMenuMover.AppendMenu( i++, ((CMover*)pObj)->GetId() , ((CMover*)pObj)->GetName( TRUE ) );
pWndButton->m_shortcut.m_dwShortcut = SHORTCUT_OBJECT;
}
END_OBJ
}
END_LAND
m_wndMenuMover.Move( CPoint( rect.left - m_wndMenuMover.GetWindowRect().Width(), rect.top ) );
m_wndMenuMover.SetVisible( !m_wndMenuMover.IsVisible() );
m_wndMenuMover.SetFocus();
}
break;
case 100005: // zoom in
m_nSizeCnt = 1;
m_size.cx += 32;
m_size.cy += 32;
if(m_size.cx > 352)
m_size.cx = 352;
if(m_size.cy > 352 )
m_size.cy = 352;
/*
if(m_size.cx > 1024)
m_size.cx = 1024;
if(m_size.cy > 1024 )
m_size.cy = 1024;
*/
ResizeMiniMap();
break;
case 100006: // zoom out
m_nSizeCnt = -1;
m_size.cx -= 32;
m_size.cy -= 32;
if( m_size.cx < 128 )
m_size.cx = 128;
if( m_size.cy < 128 )
m_size.cy = 128;
ResizeMiniMap();
break;
}
}
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
void CWndNavigator::OnLButtonDblClk( UINT nFlags, CPoint point)
{
if( g_pPlayer == NULL )
return;
if( g_pPlayer->IsAuthHigher( AUTH_GAMEMASTER ) )
{
CRect rect = GetClientRect();
CPoint pt = point;
pt.x -= ( rect.Width() / 2 );
pt.y -= ( rect.Height() / 2 );
FLOAT fx = (FLOAT)m_size.cx / ( MAP_SIZE * MPU );//(FLOAT)m_size.cx / (FLOAT)MINIMAP_SIZE;// * 2;
FLOAT fy = (FLOAT)m_size.cy / ( MAP_SIZE * MPU );//(FLOAT)m_size.cy / (FLOAT)MINIMAP_SIZE;// * 2;
D3DXVECTOR3 vPos = g_pPlayer->GetPos();
vPos.x += ( pt.x / fx );
vPos.z -= ( pt.y / fy );
CString string;
string.Format( "/teleport %d %f %f", g_WorldMng()->m_dwWorldID, vPos.x, vPos.z );
g_DPlay.SendChat( string );
}
}
BOOL CWndNavigator::OnCommand( UINT nID, DWORD dwMessage, CWndBase* pWndBase )
{
if( pWndBase == &m_wndMenuMover )
{
if( nID >= 0 && nID < 100000 )
{
CMover* pMover = prj.GetMover( nID );
g_WorldMng()->SetObjFocus( pMover );
SetFocus();
#if __VER >= 15 // __IMPROVE_QUEST_INTERFACE
g_WndMng.m_pWndWorld->m_vDestinationArrow = pMover->m_vPos;
#endif // __IMPROVE_QUEST_INTERFACE
}
}
/*
CRect rect = GetWindowRect( TRUE );
switch(nID)
{
case 100: // wnd1
m_wndMenu.Move( CPoint( rect.right, rect.top ) );
m_wndMenu.SetVisible( !m_wndMenu.IsVisible() );
m_wndMenu.SetFocus();
break;
}
*/
return CWndNeuz::OnCommand(nID,dwMessage,pWndBase);
}
void CWndNavigator::SetWndRect( CRect rectWnd, BOOL bOnSize )
{
AdjustMinRect( &rectWnd, 16 * 6, 16 * 7 );
AdjustMaxRect( &rectWnd, 16 * 12, 16 * 13 );
CWndNeuz::SetWndRect( rectWnd, bOnSize );
}
void CWndNavigator::OnSize(UINT nType, int cx, int cy)
{
m_wndPlace.Move( CPoint( 0, 0 ) );
m_wndZoomIn.Move( CPoint(0, cy - 32 ) );
m_wndZoomOut.Move( CPoint(0, cy - 16 ) );
CWndNeuz::OnSize(nType,cx,cy);
}
void CWndNavigator::OnRButtonDown(UINT nFlags, CPoint point)
{
CWorld* pWorld = g_WorldMng();
pWorld->SetObjFocus( NULL );
g_pPlayer->ClearDest();
#if __VER >= 15 // __FIND_OBJ_INSIGHT
m_wndMenuMover.DeleteAllMenu();
CLandscape* pLand;
CObj* pObj;
CWndButton* pWndButton;
int i = 0;
CMover* pMover = NULL;
int nTarget = 0;
FOR_LAND( pWorld, pLand, pWorld->m_nVisibilityLand, FALSE )
{
FOR_OBJ( pLand, pObj, OT_MOVER )
{
pMover = ( CMover* )pObj;
if( !pMover->IsPlayer( ) && pMover->GetCharacter( ) ) //NPCÀΰæ¿ì¸¸
{
pWndButton = m_wndMenuMover.AppendMenu( i++, ((CMover*)pObj)->GetId() , ((CMover*)pObj)->GetName( TRUE ) );
pWndButton->m_shortcut.m_dwShortcut = SHORTCUT_OBJECT;
++nTarget;
}
}
END_OBJ
}
END_LAND
if( nTarget > 0 )
{
CRect rect = GetWindowRect( TRUE );
#if __VER >= 15 // __IMPROVE_SYSTEM_VER15
CRect rectRootLayout = m_pWndRoot->GetLayoutRect();
int nMenuMoverLeft = rect.left - m_wndMenuMover.GetWindowRect().Width();
if( nMenuMoverLeft < rectRootLayout.left )
m_wndMenuMover.Move( CPoint( rect.right, rect.top ) );
else
m_wndMenuMover.Move( CPoint( nMenuMoverLeft, rect.top ) );
#else // __IMPROVE_SYSTEM_VER15
m_wndMenuMover.Move( CPoint( rect.left - m_wndMenuMover.GetWindowRect().Width(), rect.top ) );
#endif // __IMPROVE_SYSTEM_VER15
m_wndMenuMover.SetVisible( !m_wndMenuMover.IsVisible() );
m_wndMenuMover.SetFocus();
}
#endif
}
void CWndNavigator::OnLButtonUp(UINT nFlags, CPoint point)
{
}
void CWndNavigator::OnLButtonDown(UINT nFlags, CPoint point)
{
CRect rect = GetClientRect();
D3DXVECTOR3 vPos, vCenter = ( g_pPlayer != NULL ? g_pPlayer->GetPos() : D3DXVECTOR3( 0, 0 , 0 ) );
// 128 : m_texture.m_size.cx = 1 : x
FLOAT fx = (FLOAT)m_size.cx / ( MAP_SIZE * MPU );
FLOAT fy = (FLOAT)m_size.cy / ( MAP_SIZE * MPU );
CWorld* pWorld = g_WorldMng();
g_pPlayer->m_nvPoint.Pos.x = vCenter.x + ( (float)( point.x - (rect.right / 2) ) / fx );
g_pPlayer->m_nvPoint.Pos.z = vCenter.z - ( (float)( point.y - (rect.bottom / 2) ) / fy );
// ÀÌ ½Ã°£Àº ³×ºñ°ÔÀÌÅÍ¿¡ ³²¾Æ ÀÖ´Â ½Ã°£À¸·Î µðÆÄÀÎÀ̳ª ÆÄÀÏ·Î »¬¼öµµ ÀÖÀ»µíÇÏÁö¸¸ ¿ì¼± Çϵå ÄÚµùÀÌ´å
g_pPlayer->m_nvPoint.Time = 200;
if( pWorld )
{
CObj* pObj = pWorld->GetObjFocus();
if( IsValidObj( pObj ) && pObj->GetType() == OT_MOVER && ( (CMover*)pObj )->IsPlayer() )
{
g_DPlay.SendSetNaviPoint( g_pPlayer->m_nvPoint.Pos, ( (CCtrl*)pObj )->GetId() );
}
else
{
if( g_Party.IsMember( g_pPlayer->m_idPlayer ) )
g_DPlay.SendSetNaviPoint( g_pPlayer->m_nvPoint.Pos, NULL_ID );
}
}
vCenter.x *= fx;
vCenter.z *= fy;
int xCenter = (int)( vCenter.x );
int yCenter = (int)( - vCenter.z );
CObj* pObj;
CLandscape* pLand;
// CWorld* pWorld = g_WorldMng();
CMover *pMover;
FOR_LAND( pWorld, pLand, pWorld->m_nVisibilityLand, FALSE )
{
FOR_OBJ( pLand, pObj, OT_MOVER )
{
if( pObj->GetType() == OT_MOVER )
{
pMover = (CMover *)pObj;
if( pMover->IsMode( TRANSPARENT_MODE ) == FALSE )
{
vPos = pObj->GetPos();
vPos.x *= fx;
vPos.z *= fy;
int x = (int)( ( rect.Width() / 2 ) + vPos.x );
int y = (int)( ( rect.Height() / 2 ) - vPos.z );
x -= xCenter + 2;
y -= yCenter + 2;
CRect rectHittest( x, y, x + 5, y + 5);
if( rectHittest.PtInRect( point ) )
{
if( CMover::GetActiveMover() != pObj )
pWorld->SetObjFocus( pObj );
return;
}
}
}
}
END_OBJ
}
END_LAND
}