Code:
void CWndSelectChar::OnDraw( C2DRender* p2DRender )
{
CWndButton* pWndAccept = (CWndButton*)GetDlgItem( WIDC_ACCEPT );
CWndButton* pWndCreate = (CWndButton*)GetDlgItem( WIDC_CREATE );
CWndButton* pWndDelete = (CWndButton*)GetDlgItem( WIDC_DELETE );
#if __VER >= 17
CWndStatic* pWndStaticChar[4];
pWndStaticChar[1] = (CWndStatic*)GetDlgItem( WIDC_ST_CHARNAME01 );
pWndStaticChar[2] = (CWndStatic*)GetDlgItem( WIDC_ST_CHARNAME02 );
pWndStaticChar[3] = (CWndStatic*)GetDlgItem( WIDC_ST_CHARNAME03 );
CWndButton* pWndButton1 = (CWndButton*)GetDlgItem( WIDC_BT_LEFT );
CWndButton* pWndButton2 = (CWndButton*)GetDlgItem( WIDC_BT_RIGHT );
LPWNDCTRL lpCustom[3];
lpCustom[0] = GetWndCtrl( WIDC_CUSTOM1 );
lpCustom[1] = GetWndCtrl( WIDC_CUSTOM2 );
lpCustom[2] = GetWndCtrl( WIDC_CUSTOM3 );
LPWNDCTRL lpStatic[3];
lpStatic[0] = GetWndCtrl( WIDC_ST_CHARNAME01 );
lpStatic[1] = GetWndCtrl( WIDC_ST_CHARNAME02 );
lpStatic[2] = GetWndCtrl( WIDC_ST_CHARNAME03 );
pWndButton1->EnableWindow( false );
pWndButton2->EnableWindow( false );
pWndButton1->SetVisible( false );
pWndButton2->SetVisible( false );
#endif
CRect rect;
for( int i = 0; i < MAX_CHARACTER_LIST; i++ )
{
rect = m_aRect[ i ];
if( g_Neuz.m_apPlayer[i] != NULL )
{
if( g_WndMng.GetWndBase( APP_2ND_PASSWORD_NUMBERPAD ) == NULL )
{
POINT point = GetMousePoint();
if( m_aRect[ i ].PtInRect( point ) )
{
CRect rectHittest = m_aRect[ i ];
CPoint point2 = point;
ClientToScreen( &point2 );
ClientToScreen( rectHittest );
g_WndMng.PutToolTip_Character( i, point2, &rectHittest );
}
}
if( m_nSelectCharacter == i )
{
#if __VER >= 17
CRect rectNew;
CRect rectFlash;
rectNew.top = lpCustom[i]->rect.top;
rectNew.left = lpCustom[i]->rect.left;
rectNew.bottom = lpCustom[i]->rect.bottom;
rectNew.right = lpCustom[i]->rect.right;
rectFlash.top = lpStatic[i]->rect.top + 3;
rectFlash.left = lpStatic[i]->rect.left + 2;
rectFlash.bottom = lpStatic[i]->rect.bottom - 3;
rectFlash.right = lpStatic[i]->rect.right - 2;
// Background
p2DRender->RenderFillRect(rectNew, D3DCOLOR_ARGB( 20, 80, 250, 80 ) );
// Flash
p2DRender->RenderFillRect(rectFlash, D3DCOLOR_ARGB( m_nFlashAlpha, 80, 250, 80 ) );
#else
CRect rectTemp = rect;
rectTemp.top += 10;
rectTemp.bottom -= 10;
rectTemp.left += i;
rectTemp.right += i;
p2DRender->RenderFillRect(rectTemp, D3DCOLOR_ARGB( 20, 80, 250, 80 ) );
#endif
#if __VER >= 17
pWndStaticChar[i+1]->SetTitle( g_Neuz.m_apPlayer[i]->GetName() );
switch( i )
{
case 0: pWndStaticChar[1]->m_dwColor = 0xFFCA6544, pWndStaticChar[2]->m_dwColor = 0xFF666666, pWndStaticChar[3]->m_dwColor = 0xFF666666; break;
case 1: pWndStaticChar[1]->m_dwColor = 0xFF666666, pWndStaticChar[2]->m_dwColor = 0xFFCA6544, pWndStaticChar[3]->m_dwColor = 0xFF666666; break;
case 2: pWndStaticChar[1]->m_dwColor = 0xFF666666, pWndStaticChar[2]->m_dwColor = 0xFF666666, pWndStaticChar[3]->m_dwColor = 0xFFCA6544; break;
}
#else
p2DRender->TextOut( rect.left, rect.bottom + 10, g_Neuz.m_apPlayer[i]->GetName(), 0xffFF0000 );
p2DRender->TextOut( rect.left + 1, rect.bottom + 10, g_Neuz.m_apPlayer[i]->GetName(), 0xffFF0000 );
#endif
}
else
{
#if __VER >= 17
pWndStaticChar[i+1]->SetTitle( g_Neuz.m_apPlayer[i]->GetName() );
#else
p2DRender->TextOut( rect.left, rect.bottom + 10, g_Neuz.m_apPlayer[i]->GetName(), 0xff505050 );
#endif
}
CModelObject* pModel = (CModelObject*)m_pBipedMesh[ i ];
LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice;
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetRenderState( D3DRS_AMBIENT, D3DCOLOR_ARGB( 255, 255,255,255) );
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
D3DVIEWPORT9 viewport;
#if __VER >= 17
viewport.X = p2DRender->m_ptOrigin.x + lpCustom[i]->rect.left;
viewport.Y = p2DRender->m_ptOrigin.y + lpCustom[i]->rect.top;
#else
viewport.X = p2DRender->m_ptOrigin.x + rect.left;
viewport.Y = p2DRender->m_ptOrigin.y + rect.top;
#endif
viewport.Width = rect.Width();
viewport.Height = rect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
pd3dDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0xffa08080, 1.0f, 0 ) ;
CRect rectViewport( 0, 0, viewport.Width, viewport.Height );
D3DXMATRIX matProj;
D3DXMatrixIdentity( &matProj );
FLOAT fAspect = ((FLOAT)viewport.Width) / (FLOAT)viewport.Height;
D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4.0f, fAspect, CWorld::m_fNearPlane - 0.01f, CWorld::m_fFarPlane );
pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
D3DXMATRIX matView;
D3DXVECTOR3 vecLookAt( 0.0f, 0.0f, 1.0f );
D3DXVECTOR3 vecPos( 0.0f, 0.5f, -3.5f );
D3DXMatrixLookAtLH( &matView, &vecPos, &vecLookAt, &D3DXVECTOR3(0.0f,1.0f,0.0f) );
pd3dDevice->SetTransform( D3DTS_VIEW, &matView );
D3DXMATRIXA16 matWorld;
D3DXMATRIXA16 matScale;
D3DXMATRIXA16 matRot;
D3DXMATRIXA16 matTrans;
D3DXMatrixIdentity(&matScale);
D3DXMatrixIdentity(&matRot);
D3DXMatrixIdentity(&matTrans);
D3DXMatrixIdentity(&matWorld);
D3DXMatrixScaling(&matScale,1.6f,1.6f,1.6f);
D3DXMatrixTranslation(&matTrans,0.0f,-1.15f,0.0f);
D3DXMatrixMultiply(&matWorld,&matWorld,&matScale);
D3DXMatrixMultiply(&matWorld, &matWorld,&matRot);
D3DXMatrixMultiply(&matWorld, &matWorld, &matTrans );
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
::SetLight( FALSE );
::SetFog( FALSE );
SetDiffuse( 1.0f, 1.0f, 1.0f );
SetAmbient( 1.0f, 1.0f, 1.0f );
O3D_ELEMENT *pElem = pModel->GetParts( PARTS_RIDE );
if( pElem && pElem->m_pObject3D )
pModel->TakeOffParts( PARTS_RIDE );
pElem = pModel->GetParts( PARTS_HAIR );
if( pElem && pElem->m_pObject3D )
{
pElem->m_pObject3D->m_fAmbient[0] = g_Neuz.m_apPlayer[i]->m_fHairColorR;
pElem->m_pObject3D->m_fAmbient[1] = g_Neuz.m_apPlayer[i]->m_fHairColorG;
pElem->m_pObject3D->m_fAmbient[2] = g_Neuz.m_apPlayer[i]->m_fHairColorB;
}
D3DXVECTOR4 vConst( 1.0f, 1.0f, 1.0f, 1.0f );
#ifdef __YENV
g_Neuz.m_pEffect->SetVector( g_Neuz.m_hvFog, &vConst );
#else //__YENV
pd3dDevice->SetVertexShaderConstantF( 95, (float*)&vConst, 1 );
#endif //__YENV
::SetTransformView( matView );
::SetTransformProj( matProj );
g_Neuz.m_apPlayer[i]->OverCoatItemRenderCheck(pModel);
// Çï¸äÀÌ ¸Ó¸®Ä«¶ô ³¯·Á¾ßÇϴ°ÍÀ̳Ä? // Àκ¥ÀÌ ¾ø´Â°æ¿ì
DWORD dwId = g_Neuz.m_apPlayer[i]->m_aEquipInfo[PARTS_CAP].dwId;
ItemProp* pItemProp = NULL;
if( dwId != NULL_ID )
{
O3D_ELEMENT* pElement = NULL;
pItemProp = prj.GetItemProp( dwId );
if( pItemProp && pItemProp->dwBasePartsIgnore != -1 )
{
pElement = pModel->SetEffect(pItemProp->dwBasePartsIgnore, XE_HIDE );
}
// ¿ÜÅõÀÇ»óÀ» ÀÔ¾úÀ»°æ¿ì ¸Ó¸®³¯¸±°ÍÀΰ¡ÀÇ ±âÁØÀ» ¿ÜÅõ ¸ðÀÚ¸¦ ±âÁØÀ¸·Î ¹Ù²Û´Ù
dwId = g_Neuz.m_apPlayer[i]->m_aEquipInfo[PARTS_HAT].dwId;
if( dwId != NULL_ID )
{
if( !(g_Neuz.m_apPlayer[i]->m_aEquipInfo[PARTS_HAT].byFlag & CItemElem::expired) )
{
pItemProp = prj.GetItemProp( dwId );
if( pItemProp && pItemProp->dwBasePartsIgnore != -1 )
{
if( pItemProp->dwBasePartsIgnore == PARTS_HEAD )
pModel->SetEffect(PARTS_HAIR, XE_HIDE );
pModel->SetEffect(pItemProp->dwBasePartsIgnore, XE_HIDE );
}
else
{
if( pElement )
pElement->m_nEffect &= ~XE_HIDE;
}
}
}
}
else
{
// ¿ÜÅõÀÇ»óÀ» ÀÔ¾úÀ»°æ¿ì ¸Ó¸®³¯¸±°ÍÀΰ¡ÀÇ ±âÁØÀ» ¿ÜÅõ ¸ðÀÚ¸¦ ±âÁØÀ¸·Î ¹Ù²Û´Ù
dwId = g_Neuz.m_apPlayer[i]->m_aEquipInfo[PARTS_HAT].dwId;
if( dwId != NULL_ID )
{
if( !(g_Neuz.m_apPlayer[i]->m_aEquipInfo[PARTS_HAT].byFlag & CItemElem::expired) )
{
pItemProp = prj.GetItemProp( dwId );
if( pItemProp && pItemProp->dwBasePartsIgnore != -1 )
{
if( pItemProp->dwBasePartsIgnore == PARTS_HEAD )
pModel->SetEffect(PARTS_HAIR, XE_HIDE );
pModel->SetEffect(pItemProp->dwBasePartsIgnore, XE_HIDE );
}
}
}
}
#ifdef __YENV
SetLightVec( D3DXVECTOR3( 0.0f, 0.0f, 1.0f ) );
#endif //__YENV
pModel->Render( p2DRender->m_pd3dDevice, &matWorld );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
p2DRender->m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
#if __VER >= 17
viewport.X = p2DRender->m_ptOrigin.x + lpCustom[i]->rect.left;
viewport.Y = p2DRender->m_ptOrigin.y + lpCustom[i]->rect.top;
#else
viewport.X = p2DRender->m_ptOrigin.x + 5;
viewport.Y = p2DRender->m_ptOrigin.y + 5;
#endif
viewport.Width = p2DRender->m_clipRect.Width();
viewport.Height = p2DRender->m_clipRect.Height();
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
pd3dDevice->SetViewport(&viewport);
}
else
{
#if __VER >= 17
pWndStaticChar[i+1]->SetTitle( "" );
#else
if( m_nSelectCharacter == i )
p2DRender->TextOut( rect.left, rect.bottom + 10, prj.GetText( TID_GAME_WND_SELECT_CHARACTER_EMPTY ), 0xff6060ff );
else
p2DRender->TextOut( rect.left, rect.bottom + 10, prj.GetText( TID_GAME_WND_SELECT_CHARACTER_EMPTY ), 0xff505050 );
#endif
}
if( m_nSelectCharacter == i )
{
if( g_Neuz.m_apPlayer[i] )
{
pWndCreate->EnableWindow( FALSE );
pWndAccept->EnableWindow( TRUE );
pWndDelete->EnableWindow( TRUE );
}
else
{
pWndCreate->EnableWindow( TRUE );
pWndAccept->EnableWindow( FALSE );
pWndDelete->EnableWindow( FALSE );
#if __VER >= 17
switch( i )
{
case 0: pWndStaticChar[1]->m_dwColor = 0xFFCA6544, pWndStaticChar[2]->m_dwColor = 0xFF666666, pWndStaticChar[3]->m_dwColor = 0xFF666666; break;
case 1: pWndStaticChar[1]->m_dwColor = 0xFF666666, pWndStaticChar[2]->m_dwColor = 0xFFCA6544, pWndStaticChar[3]->m_dwColor = 0xFF666666; break;
case 2: pWndStaticChar[1]->m_dwColor = 0xFF666666, pWndStaticChar[2]->m_dwColor = 0xFF666666, pWndStaticChar[3]->m_dwColor = 0xFFCA6544; break;
}
#endif
}
}
}
} jetzt sucht ihr:
Lesezeichen