void CDialogMsg::Render( C2DRender* p2DRender ) { CSize size; LPCUSTOMTEXT lpCustomText; // CD3DFont* pOldFont = p2DRender->GetFont(); // p2DRender->SetFont( CWndBase::m_Theme.m_pFontWndTitle ); LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice; pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, 1 ); pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, 1 ); pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT ); pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT ); pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE ); pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR ); TEXTUREVERTEX vertex[ 4 * 18 ]; CPoint point; int nIndex; for( int i = 0; i < m_textArray.GetSize(); i++ ) { lpCustomText = (LPCUSTOMTEXT) m_textArray.GetAt( i ); TEXTUREVERTEX* pVertices = vertex; if( !lpCustomText->m_bInfinite && lpCustomText->m_timer.TimeOut() ) { // 퀘스트 이모티콘을 다시 보이게 한다. if( lpCustomText->m_pObj->GetType() == OT_MOVER ) ((CMover*)lpCustomText->m_pObj)->m_bShowQuestEmoticon = TRUE; safe_delete( lpCustomText ); m_textArray.RemoveAt( i ); i --; } else { CObj* pObj = lpCustomText->m_pObj; if( lpCustomText->m_pTexture ) { if( pObj->IsCull() == FALSE ) { // 월드 좌표를 스크린 좌표로 프로젝션 한다. D3DXVECTOR3 vOut, vPos = pObj->GetPos(), vPosHeight; D3DVIEWPORT9 vp; const BOUND_BOX* pBB; if( pObj->m_pModel ) pBB = pObj->m_pModel->GetBBVector(); else return; pd3dDevice->GetViewport( &vp ); D3DXMATRIX matTrans; D3DXMATRIX matWorld; D3DXMatrixIdentity(&matWorld); D3DXMatrixTranslation( &matTrans, vPos.x, vPos.y , vPos.z); D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixScale() ); D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixRotation() ); D3DXMatrixMultiply( &matWorld, &matWorld, &matTrans ); vPosHeight = pBB->m_vPos[0]; vPosHeight.x = 0; vPosHeight.z = 0; D3DXVec3Project( &vOut, &vPosHeight, &vp, &pObj->GetWorld()->m_matProj, &pObj->GetWorld()->m_pCamera->m_matView, &matWorld); CPoint point; point.x = (LONG)( vOut.x - 32 / 2 ); point.y = (LONG)( vOut.y - 32 ); MakeEven( point.x ); p2DRender->RenderTexture( point, lpCustomText->m_pTexture ); } } else { LPCTSTR lpStr = lpCustomText->m_string; lpCustomText->m_pFont->GetTextExtent( (TCHAR*)lpStr, &size ); if( pObj->IsCull() == FALSE ) { int nAlpha = 200; if( !lpCustomText->m_bInfinite && lpCustomText->m_timer.GetLeftTime() > 4000 ) nAlpha = (int)( 200 - ( ( lpCustomText->m_timer.GetLeftTime() - 4000 )* 200 / 1000 ) ); // 월드 좌표를 스크린 좌표로 프로젝션 한다. D3DXVECTOR3 vOut, vPos = pObj->GetPos(), vPosHeight; D3DVIEWPORT9 vp; const BOUND_BOX* pBB; if( pObj->m_pModel ) pBB = pObj->m_pModel->GetBBVector(); else return; pd3dDevice->GetViewport( &vp ); D3DXMATRIX matTrans; D3DXMATRIX matWorld; D3DXMatrixIdentity(&matWorld); D3DXMatrixTranslation( &matTrans, vPos.x, vPos.y , vPos.z); D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixScale() ); D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixRotation() ); D3DXMatrixMultiply( &matWorld, &matWorld, &matTrans ); vPosHeight = pBB->m_vPos[0]; vPosHeight.x = 0; vPosHeight.z = 0; D3DXVec3Project( &vOut, &vPosHeight, &vp, &pObj->GetWorld()->m_matProj, &pObj->GetWorld()->m_pCamera->m_matView, &matWorld); CRect rect = lpCustomText->m_rect; vOut.x -= rect.Width() / 2; vOut.y -= rect.Height(); CPoint ptOrigin = p2DRender->GetViewportOrg(); vOut.y *= 0.9f; FLOAT x = vOut.x; FLOAT y = vOut.y; int nHeight = rect.Height() / 8; int nWidth = rect.Width() / 8; CTexture* pTexture; FLOAT fEdge = 8.0f; FLOAT fWidth = ( nWidth <= 5 ) ? rect.Width() * 0.7f : rect.Width() * 0.9f; FLOAT fHeight = rect.Height() * 0.75f; FLOAT fOffsetX = 0; FLOAT fOffsetY = 0; nIndex = 0; int i; if( lpCustomText->m_nKind == CHAT_SHOUT ) { char buffer[256] = { 0 }; // 텍스쳐렌더 버그 관련 수정 CTexture* pShoutTex = NULL; int nlen = _tcsclen(lpStr); if( nlen >= 1 && nlen <= 1 ) strcpy( buffer, "texDialogBoxShout00.bmp" ); else if( nlen >= 2 && nlen <= 3 ) strcpy( buffer, "texDialogBoxShout01.bmp" ); else if( nlen >= 4 && nlen <= 5 ) strcpy( buffer, "texDialogBoxShout02.bmp" ); else if( nlen >= 6 && nlen <= 9 ) strcpy( buffer, "texDialogBoxShout03.bmp" ); else if( nlen >= 10 && nlen <= 20 ) strcpy( buffer, "texDialogBoxShout04.bmp" ); else if( nlen >= 21 && nlen <= 40 ) strcpy( buffer, "texDialogBoxShout05.bmp" ); else if( nlen >= 41 && nlen <= 60 ) strcpy( buffer, "texDialogBoxShout06.bmp" ); else if( nlen >= 61 ) strcpy( buffer, "texDialogBoxShout07.bmp" ); pShoutTex = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_THEME, buffer ), 0xffff00ff ); if( pShoutTex ) { p2DRender->RenderTextureEx( CPoint( (int)( x-20 ), (int)( y-20 ) ), CPoint( (int)( fWidth+50.0f ), (int)( fHeight+40.0f ) ), pShoutTex, nAlpha, 1.0f, 1.0f, FALSE ); goto g_ShoutChat; } } for( i=0; i<3; i++ ) { if( i==0 || i==2 ) fOffsetY=fEdge; else fOffsetY=fHeight; fOffsetX = 0; for( int j=0; j<3; j++ ) { if( j==0 || j==2 ) fOffsetX = fEdge; else fOffsetX = fWidth; pTexture = m_texPack_ex[lpCustomText->m_nKind].GetAt( nIndex ); SetTextureVertex( pVertices, x, y, pTexture->m_fuLT, pTexture->m_fvLT ); pVertices++; SetTextureVertex( pVertices, x+fOffsetX, y, pTexture->m_fuRT, pTexture->m_fvRT ); pVertices++; SetTextureVertex( pVertices, x, y+fOffsetY, pTexture->m_fuLB, pTexture->m_fvLB ); pVertices++; SetTextureVertex( pVertices, x, y+fOffsetY, pTexture->m_fuLB, pTexture->m_fvLB ); pVertices++; SetTextureVertex( pVertices, x+fOffsetX, y, pTexture->m_fuRT, pTexture->m_fvRT ); pVertices++; SetTextureVertex( pVertices, x+fOffsetX, y+fOffsetY, pTexture->m_fuRB, pTexture->m_fvRB ); pVertices++; x+=fOffsetX; nIndex++; } x = vOut.x; y+=fOffsetY; } // 꼬랑지 출력 if( nWidth >= 6 ) { point = CPoint( (int)( x + ( 3 * nWidth / 5 ) * 8 ), (int)( y ) ); nIndex = 9; } else if( nWidth == 4 || nWidth == 5 ) { point = CPoint( (int)( x + 3 * 8 ), (int)( y ) ); nIndex = 9; } else if( nWidth == 3 ) { point = CPoint( (int)( x + 1 * 8 ), (int)( y ) ); nIndex = 9; } pTexture = m_texPack_ex[lpCustomText->m_nKind].GetAt( nIndex ); SetTextureVertex( pVertices, (FLOAT)( point.x ), (FLOAT)( point.y ), pTexture->m_fuLT, pTexture->m_fvLT ); pVertices++; SetTextureVertex( pVertices, (FLOAT)( point.x + 8.0f ), (FLOAT)( point.y ), pTexture->m_fuRT, pTexture->m_fvRT); pVertices++; SetTextureVertex( pVertices, (FLOAT)( point.x ), (FLOAT)( point.y + 8.0f ), pTexture->m_fuLB, pTexture->m_fvLB); pVertices++; SetTextureVertex( pVertices, (FLOAT)( point.x + 8.0f ), (FLOAT)( point.y ), pTexture->m_fuRT, pTexture->m_fvRT); pVertices++; SetTextureVertex( pVertices, (FLOAT)( point.x ), (FLOAT)( point.y + 8.0f ), pTexture->m_fuLB, pTexture->m_fvLB); pVertices++; SetTextureVertex( pVertices, (FLOAT)( point.x + 8.0f ), (FLOAT)( point.y + 8.0f ), pTexture->m_fuRB, pTexture->m_fvRB); pVertices++; pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB( nAlpha, 0, 0, 0 ) ); pd3dDevice->SetVertexShader( NULL ); pd3dDevice->SetTexture( 0, m_texPack_ex[lpCustomText->m_nKind].GetAt( 0 )->m_pTexture ); pd3dDevice->SetFVF( D3DFVF_TEXTUREVERTEX ); pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLELIST, 20, vertex, sizeof( TEXTUREVERTEX ) ); g_ShoutChat: /* CPoint point; point.x = vOut.x + 8;; point.y = vOut.y + 8;; */ x = vOut.x + 8; y = vOut.y + 8; x -= ptOrigin.x; y -= ptOrigin.y; /* point.x -= ptOrigin.x; MakeEven( point.x ); point.y -= ptOrigin.y; */ lpCustomText->m_string.SetAlpha( nAlpha ); // p2DRender->TextOut_EditString( point.x, point.y, lpCustomText->m_string, 0, 0, 0 ); p2DRender->TextOut_EditString( (int)( x ), (int)( y ), lpCustomText->m_string, 0, 0, 0 ); } } } } for( i = 0; i < m_VendortextArray.GetSize(); i++ ) { lpCustomText = (LPCUSTOMTEXT) m_VendortextArray.GetAt( i ); TEXTUREVERTEX* pVertices = vertex; LPCTSTR lpStr = lpCustomText->m_string; lpCustomText->m_pFont->GetTextExtent( (TCHAR*)lpStr, &size ); CObj* pObj = lpCustomText->m_pObj; if( pObj->IsCull() == FALSE ) { int nAlpha = 200; // 월드 좌표를 스크린 좌표로 프로젝션 한다. D3DXVECTOR3 vOut, vPos = pObj->GetPos(), vPosHeight; D3DVIEWPORT9 vp; const BOUND_BOX* pBB; if( pObj->m_pModel ) pBB = pObj->m_pModel->GetBBVector(); else return; pd3dDevice->GetViewport( &vp ); D3DXMATRIX matTrans; D3DXMATRIX matWorld; D3DXMatrixIdentity(&matWorld); D3DXMatrixTranslation( &matTrans, vPos.x, vPos.y , vPos.z); D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixScale() ); D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixRotation() ); D3DXMatrixMultiply( &matWorld, &matWorld, &matTrans ); vPosHeight = pBB->m_vPos[0]; vPosHeight.x = 0; vPosHeight.z = 0; D3DXVec3Project( &vOut, &vPosHeight, &vp, &pObj->GetWorld()->m_matProj, &pObj->GetWorld()->m_pCamera->m_matView, &matWorld); CRect rect = lpCustomText->m_rect; vOut.x -= rect.Width() / 2; vOut.y -= rect.Height(); DWORD dwMaxHeight = lpCustomText->m_pFont->GetMaxHeight(); CPoint ptOrigin = p2DRender->GetViewportOrg(); int x = (int)( vOut.x ); int y = (int)( vOut.y ); int nHeight = rect.Height() / 8; int nWidth = rect.Width() / 8; FLOAT fGap = 40; FLOAT fWidth = (FLOAT)( rect.Width() ); FLOAT fHeight = rect.Height()*0.8f; fGap += 2.0f; CPoint ptTex1; CPoint ptTex2; ptTex1.x = (LONG)( vOut.x-24 ); ptTex1.y = (LONG)( vOut.y-fGap ); p2DRender->RenderTexture(ptTex1, m_pTex[0], nAlpha, 1.0f, 1.0f ); ptTex1.x = (LONG)( vOut.x+8 ); ptTex1.y = (LONG)( vOut.y-fGap ); ptTex2.x = (int)fWidth; ptTex2.y = 32; p2DRender->RenderTextureEx( ptTex1, ptTex2, m_pTex[1], nAlpha, 1.0f, 1.0f ); ptTex1.x = (LONG)( (int)(vOut.x+8)+ptTex2.x ); ptTex1.y = (LONG)( vOut.y-fGap ); p2DRender->RenderTexture(ptTex1, m_pTex[2], nAlpha, 1.0f, 1.0f ); fGap -= 2.0f; x = (int)( vOut.x + 8 ); y = (int)( vOut.y + 8 ); x -= ptOrigin.x; y -= ptOrigin.y; lpCustomText->m_string.SetAlpha( 250 ); p2DRender->TextOut_EditString( x, (int)( y-fGap ), lpCustomText->m_string, 0, 0, 0 ); } } }
int CWndWorld::ControlFlying( DWORD dwMessage, CPoint point ) { static float fTurnAngle = 0.0f; static BOOL s_bTraceKeyed = 0, s_bSelectKeyed = 0, s_bTurbo2 = 0; // static BOOL s_bFastTurn; int nMsg = 0; // BOOL bFlyKey; BOOL bUp, bDown, bLeft, bRight; BOOL bAcc = FALSE; BOOL bTurbo; // BOOL bFastTurn = FALSE; BYTE nFrame = MAX_CORR_SIZE_150; CMover* pMover = CMover::GetActiveMover(); bUp = g_bKeyTable[g_Neuz.Key.chUp]; bDown = g_bKeyTable['S']; // 좌/우 회전 bLeft = g_bKeyTable[g_Neuz.Key.chLeft]; bRight = g_bKeyTable['D']; // 급선회. // bFastTurn = g_bKeyTable[ VK_SHIFT ]; // CMover* pMoverTarget = (CMover*)g_WorldMng.Get()->GetObjFocus() ; // 가속 상태면 전진 명령 계속 보냄 bool fMoved = false; bool fBehavior = false; if( pMover->m_pActMover->IsStateFlag( OBJSTAF_ACC ) ) { if( pMover->SendActMsg( OBJMSG_FORWARD ) == 1 ) { fMoved = true; } } else { if( pMover->SendActMsg( OBJMSG_STAND ) == 1 ) { fMoved = true; } } // bAcc = g_bKeyTable[VK_SPACE]; if( bAcc && !s_bAccKeyed ) // 키 누른순간에만 토글시킴. { if( pMover->m_pActMover->IsStateFlag( OBJSTAF_ACC ) ) // 가속중이었다면 { pMover->SendActMsg( OBJMSG_ACC_STOP ); // 가속 멈춤 if( pMover->m_pActMover->IsActTurn() ) { fMoved = true; } } else { // 가속중이 아니었다면 가속 시킴. if( pMover->SendActMsg( OBJMSG_ACC_START ) == 0 ) g_WndMng.PutString( prj.GetText( TID_GAME_AIRFUELEMPTY ) ); else { if( pMover->SendActMsg( OBJMSG_FORWARD ) == 1 ) fMoved = true; } } } s_bAccKeyed = bAcc; bTurbo = g_bKeyTable[g_Neuz.Key.chWalk]; if( bTurbo && !s_bTurbo2 ) // 토글 방식. { if( pMover->m_pActMover->IsStateFlag( OBJSTAF_TURBO ) ) { if( pMover->SendActMsg( OBJMSG_MODE_TURBO_OFF ) == 1 ) fMoved = true; } else { if( pMover->SendActMsg( OBJMSG_MODE_TURBO_ON ) == 1 ) fMoved = true; } } s_bTurbo2 = bTurbo; if( pMover->m_pActMover->IsFly() ) { if( g_bKeyTable[g_Neuz.Key.chTrace] && !s_bTraceKeyed ) { CCtrl* pFocusObj = (CCtrl*)(pMover->GetWorld()->GetObjFocus()); if( pFocusObj && pFocusObj->GetType() == OT_MOVER ) { CMover* pFocusMover = (CMover*)pFocusObj; if( pMover->m_dwFlag & MVRF_TRACKING ) // 이미 실행중이면 해제. { pMover->m_dwFlag &= (~MVRF_TRACKING); // 추적모드해제. pMover->m_idTracking = NULL_ID; } else { // 비행중 추적모드. pMover->m_dwFlag |= MVRF_TRACKING; // 추적모드. pMover->m_idTracking = pFocusMover->GetId(); } } else { // 타겟이 없을때 Z키를 누르면 자동추적이 풀린다. pMover->m_dwFlag &= (~MVRF_TRACKING); // 추적모드해제. pMover->m_idTracking = NULL_ID; } } s_bTraceKeyed = g_bKeyTable[g_Neuz.Key.chTrace]; // 타겟선택 키 if( g_bKeyTable[VK_TAB] && !s_bSelectKeyed ) { if( m_aFlyTarget.GetSize() > 0 ) // 선택된 타겟있을때. { if( m_nSelect >= m_aFlyTarget.GetSize() ) m_nSelect = 0; OBJID idSelect = m_aFlyTarget.GetAt( m_nSelect++ ); CMover *pSelectMover = prj.GetMover( idSelect ); if( IsValidObj(pSelectMover) ) { CWorld *pWorld = pMover->GetWorld(); if( pWorld ) { pWorld->SetObjFocus( pSelectMover ); // 이놈을 타겟으로 설정함. pMover->m_idTracking = pSelectMover->GetId(); // 탭으로 타겟을 바꾸면 자동추적타겟도 그놈으로 바뀐다. } } } } s_bSelectKeyed = g_bKeyTable[VK_TAB]; } if( /*m_bFlyMove &&*/ m_bLButtonDown || g_bKeyTable[VK_INSERT] ) // 192 = ` { CObj *pObj = pMover->GetWorld()->GetObjFocus(); // 타겟잡힌놈이 있을때만 휘두를수 있다. if( pObj && pObj->GetType() == OT_MOVER ) { if( pMover->IsAttackAble( pObj ) ) // 공격 가능한지 검사. { OBJID idTarget = ((CMover *)pObj)->GetId(); ItemProp *pWeapon = pMover->GetActiveHandItemProp(); if( pWeapon ) { g_pPlayer->PlayCombatMusic(); if( pWeapon->dwItemKind3 == IK3_WAND ) { D3DXVECTOR3 vFront, vTarget; AngleToVector( &vFront, g_pPlayer->GetAngle(), -g_pPlayer->GetAngleX(), 1.0f ); vTarget = pObj->GetPos() - g_pPlayer->GetPos(); D3DXVec3Normalize( &vTarget, &vTarget ); // 타겟쪽으로의 벡터의 유닛벡터. FLOAT fDot = D3DXVec3Dot( &vFront, &vTarget ); if( fDot >= cosf(D3DXToRadian(60.0f)) ) // 타겟이 내가 보는 방향의 +-30도 안에 있으면 발사할수 있다. { if( pMover->IsRangeObj( pObj, 64.0f ) ) // 사정거리에 들어오면 발사. { pMover->DoAttackMagic( pObj, 0 ); } } } else { pMover->SendActMsg( OBJMSG_ATK1, idTarget ); } } } } } // fTurnAngle = 0.6f; ItemProp* pItemProp = prj.GetItemProp( g_pPlayer->GetRideItemIdx() ); if( pItemProp ) { fTurnAngle = pItemProp->fFlightLRAngle; } else { Error( "ControlFlying : 빗자루정보 읽기 실패 %d", g_pPlayer->GetRideItemIdx() ); fTurnAngle = 0.6f; } if( bUp ) { if( g_WorldMng.Get()->GetFullHeight( pMover->GetPos() ) < pMover->GetPos().y ) { if( pMover->SendActMsg( OBJMSG_LOOKDOWN ) == 1 ) { fMoved = true; } } } else if( bDown ) { if( pMover->SendActMsg( OBJMSG_LOOKUP ) == 1 ) { fMoved = true; } } else { if( pMover->SendActMsg( OBJMSG_STOP_LOOK ) == 1 ) { fMoved = true; } } if( bLeft ) { m_fRollAng -= 1.0f; if( m_fRollAng < -45.0f ) m_fRollAng = -45.0f; if( pMover->SendActMsg( OBJMSG_LTURN, (int)( fTurnAngle * 100.0f ) ) == 1 ) { fMoved = true; } } else if( bRight ) { m_fRollAng += 1.0f; if( m_fRollAng > 45.0f ) m_fRollAng = 45.0f; if( pMover->SendActMsg( OBJMSG_RTURN, (int)( fTurnAngle * 100.0f ) ) == 1 ) { fMoved = true; } } else { if( m_fRollAng < 0 ) { m_fRollAng += 2.0f; if( m_fRollAng > 0 ) m_fRollAng = 0; } else if( m_fRollAng > 0 ) { m_fRollAng -= 2.0f; if( m_fRollAng < 0 ) m_fRollAng = 0; } if( pMover->SendActMsg( OBJMSG_STOP_TURN ) == 1 ) { fMoved = true; // fBehavior = true; } } // 오른쪽 버튼 드래그는 빗자루 움직임 if( dwMessage == WM_MOUSEMOVE /*&& m_bRButtonDown*/ ) { float fAng = pMover->GetAngle(); float fAdd = (point.x - m_ptMouseOld.x) / 2.0f; fAng -= fAdd; pMover->SetAngle( fAng ); float fAngX = pMover->GetAngleX(); float fAddX = (point.y - m_ptMouseOld.y) / 4.0f; fAngX += fAddX; if( fAddX > 0 && fAngX > 45.0f ) fAngX = 45.0f; else if( fAddX < 0 && fAngX < -45.0f ) fAngX = -45.0f; pMover->SetAngleX( fAngX ); if( fAdd || fAddX ) g_DPlay.PostPlayerAngle( TRUE ); } BOOL bTempKey; if( bTempKey = g_bKeyTable[ '8' ] ) { if( !m_bTemp3ed ) { pMover->SendActMsg( OBJMSG_TEMP2 ); // __bTestLOD ^= 1; } } m_bTemp3ed = bTempKey; if( fMoved ) { g_DPlay.SendPlayerMoved2( nFrame ); } if( fBehavior ) { pMover->ClearDest(); g_DPlay.SendPlayerBehavior2(); } return nMsg; }
void CDialogMsg::Render( C2DRender* p2DRender ) { CSize size; LPCUSTOMTEXT lpCustomText; for( int i = 0; i < m_textArray.GetSize(); i++ ) { lpCustomText = (LPCUSTOMTEXT) m_textArray.GetAt( i ); if( lpCustomText->m_timer.TimeOut() ) { // 퀘스트 이모티콘을 다시 보이게 한다. if( lpCustomText->m_pObj->GetType() == OT_MOVER ) ((CMover*)lpCustomText->m_pObj)->m_bShowQuestEmoticon = TRUE; safe_delete( lpCustomText ); m_textArray.RemoveAt( i ); i --; } else { LPCTSTR lpStr = lpCustomText->m_string; lpCustomText->m_pFont->GetTextExtent( (TCHAR*)lpStr, &size ); CObj* pObj = lpCustomText->m_pObj; if( pObj->IsCull() == FALSE ) { int nAlpha = 200; if( lpCustomText->m_timer.GetLeftTime() > 4000 ) nAlpha = 200 - ( ( lpCustomText->m_timer.GetLeftTime() - 4000 )* 200 / 1000 ); LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice; // 월드 좌표를 스크린 좌표로 프로젝션 한다. D3DXVECTOR3 vOut, vPos = pObj->GetPos(), vPosHeight; D3DVIEWPORT9 vp; const BOUND_BOX* pBB = pObj->m_pModel->GetBBVector(); pd3dDevice->GetViewport( &vp ); D3DXMATRIX matTrans; D3DXMATRIX matWorld; D3DXMatrixIdentity(&matWorld); D3DXMatrixTranslation( &matTrans, vPos.x, vPos.y , vPos.z); D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixScale() ); D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixRotation() ); D3DXMatrixMultiply( &matWorld, &matWorld, &matTrans ); vPosHeight = pBB->m_vPos[0]; vPosHeight.x = 0; vPosHeight.z = 0; D3DXVec3Project( &vOut, &vPosHeight, &vp, &pObj->GetWorld()->m_matProj, &pObj->GetWorld()->m_pCamera->m_matView, &matWorld); CRect rect = lpCustomText->m_rect; vOut.x -= rect.Width() / 2; vOut.y -= rect.Height(); CRectClip rectClip = p2DRender->m_clipRect; DWORD dwLineCount = lpCustomText->m_string.GetLineCount(); DWORD dwMaxHeight = lpCustomText->m_pFont->GetMaxHeight(); CPoint ptOrigin = p2DRender->GetViewportOrg(); p2DRender->SetViewportOrg( 0, 0 ); int x = vOut.x; int y = vOut.y; int nHeight = rect.Height() / 8; int nWidth = rect.Width() / 8; for( int i = 0; i < nHeight; i++) { int nIndex; if( i == 0 ) nIndex = 0; else if( i != nHeight - 1 ) nIndex = 3; else nIndex = 6; for( int j = 0; j < nWidth; j++) { CPoint point = CPoint( x + j * 8, y + i * 8); if( j == 0 ) m_texPack.Render( p2DRender, point, nIndex, nAlpha ); else if( j != nWidth - 1 ) { // 맨 밑쪽 /* if( i == nHeight - 1 ) { if( nWidth >= 6 && ( j == 3 * nWidth / 5 || j == 3 * nWidth / 5 + 1) ) { m_texPack.Render( p2DRender, point, 4); continue; } // 5 : 3 = 10 : 6 else if( nWidth == 5 && ( j == 2 || j == 3 ) ) { m_texPack.Render( p2DRender, point, 4); continue; } else if( nWidth == 4 && j == 2 ) { m_texPack.Render( p2DRender, point, 4); continue; } else if( nWidth == 3 && j == 1 ) { m_texPack.Render( p2DRender, point, 4); continue; } }*/ m_texPack.Render( p2DRender, point, nIndex + 1, nAlpha); } else m_texPack.Render( p2DRender, point, nIndex + 2, nAlpha); } } // 꼬랑지 출력 if( nWidth >= 6 ) m_texPack.Render( p2DRender, CPoint( x + ( 3 * nWidth / 5 ) * 8, y + i * 8 - 1), 9, nAlpha ); else if( nWidth == 5 ) m_texPack.Render( p2DRender, CPoint( x + 2 * 8, y + i * 8 - 1), 9, nAlpha ); else if( nWidth == 4 ) m_texPack.Render( p2DRender, CPoint( x + 2 * 8, y + i * 8 - 1), 11, nAlpha ); else if( nWidth == 3 ) m_texPack.Render( p2DRender, CPoint( x + 1 * 8, y + i * 8 - 1), 11 , nAlpha); p2DRender->SetViewportOrg( ptOrigin ); x = vOut.x + 8; y = vOut.y + 8; p2DRender->TextOut_EditString( x, y, lpCustomText->m_string, 0, 0, 0 ); /* for( i = 0; i < dwLineCount; i++) { CString string = lpCustomText->m_string.GetLine( i ); DWORD dwOffset = lpCustomText->m_string.GetLineOffset( i ); LPCTSTR lpszStr = string; int nLength = string.GetLength(); DWORD dwCurOffset; TCHAR strHan[ 3 ]; x = vOut.x + 8;; for( int j = 0; j < nLength; j++) { if( IsHangul( string[j] ) ) { strHan[0] = string[j++]; strHan[1] = string[j]; strHan[2] = '\0'; dwCurOffset = dwOffset + (j - 1); } else { strHan[0] = string[j]; strHan[1] = '\0'; dwCurOffset = dwOffset + j; } CSize size = lpCustomText->m_pFont->GetTextExtent(strHan); DWORD dwColor = lpCustomText->m_string.m_adwColor[dwCurOffset]; DWORD dwStyle = lpCustomText->m_string.m_abyStyle[dwCurOffset]; //p2DRender->TextOut( dwBegin, 0 + y * dwMaxHeight, strHan, dwColor); lpCustomText->m_pFont->DrawText( x, y, dwColor, (TCHAR*) strHan ); if( dwStyle & ESSTY_BOLD ) lpCustomText->m_pFont->DrawText( x + 1, y, dwColor, (TCHAR*) strHan ); if( dwStyle & ESSTY_UNDERLINE ) p2DRender->RenderLine( CPoint( x, y + size.cy ), CPoint( x + size.cx, y + size.cy ), dwColor ); x+= size.cx; } //lpCustomText->m_pFont->DrawText( x, y, D3DCOLOR_ARGB( nAlpha, 0, 0, 0 ), (TCHAR*) lpszStr ); y += dwMaxHeight; } */ } } } }