#include "StdAfx.h" #include "MAPartsBody.h" #include "DnTableDB.h" #include "DnActor.h" #include "DnParts.h" #include "DnWeapon.h" MAPartsBody::MAPartsBody() { m_pActor = NULL; m_bIsValidActor = true; memset( m_bSelfDelete, 0, sizeof(m_bSelfDelete) ); memset( m_bCashSelfDelete, 0, sizeof(m_bCashSelfDelete) ); // ¹«±â¸¦ Á¦¿ÜÇÑ Àüȯ¹öư memset( m_bPartsViewOrder, 1, sizeof(m_bPartsViewOrder) ); } MAPartsBody::~MAPartsBody() { for( DWORD i=0; i(this); if( !m_pActor ) m_bIsValidActor = false; } return true; } void MAPartsBody::LoadSkin( const char *szDummySkinName, const char *szAniName ) { if( m_hObject ) return; m_szAniFileName = szAniName; m_hObject = EternityEngine::CreateAniObject( STATICFUNC() szDummySkinName, szAniName ); m_hObject->SetCalcPositionFlag( CALC_POSITION_Y ); } bool MAPartsBody::AttachParts( DnPartsHandle hParts, CDnParts::PartsTypeEnum Index, bool bDelete ) { if( !hParts ) return false; DNTableFileFormat* pSox = GetDNTable( CDnTableDB::TPARTS ); if( !pSox ) { g_Log.Log( LogType::_FILELOG, L"PartsTable.ext failed\r\n"); return false; } if( !IsValidActor() ) return false; CDnParts::PartsTypeEnum SlotIndex = ( Index == (CDnParts::PartsTypeEnum)-1 ) ? hParts->GetPartsType() : Index; if( m_hPartsObject[SlotIndex] ) { DetachParts( SlotIndex ); } m_hPartsObject[SlotIndex] = hParts; m_bSelfDelete[SlotIndex] = bDelete; hParts->CreateObject( m_pActor->GetMySmartPtr(), m_szAniFileName.c_str() ); return true; } bool MAPartsBody::DetachParts( CDnParts::PartsTypeEnum Index ) { if( !m_hPartsObject[Index] ) return true; m_hPartsObject[Index]->FreeObject(); if( m_bSelfDelete[Index] ) { SAFE_RELEASE_SPTR( m_hPartsObject[Index] ); m_bSelfDelete[Index ] = false; } m_hPartsObject[Index].Identity(); return true; } bool MAPartsBody::AttachCashParts( DnPartsHandle hParts, CDnParts::PartsTypeEnum Index, bool bDelete ) { if( !hParts ) return false; DNTableFileFormat* pSox = GetDNTable( CDnTableDB::TPARTS ); if( !pSox ) { g_Log.Log( LogType::_FILELOG, L"PartsTable.ext failed\r\n"); return false; } if( !IsValidActor() ) return false; CDnParts::PartsTypeEnum SlotIndex = ( Index == (CDnParts::PartsTypeEnum)-1 ) ? hParts->GetPartsType() : Index; if( m_hCashPartsObject[SlotIndex] ) { DetachCashParts( SlotIndex ); } m_hCashPartsObject[SlotIndex] = hParts; m_bCashSelfDelete[SlotIndex] = bDelete; hParts->CreateObject( m_pActor->GetMySmartPtr(), m_szAniFileName.c_str() ); return true; } bool MAPartsBody::DetachCashParts( CDnParts::PartsTypeEnum Index ) { if( !m_hCashPartsObject[Index] ) return true; m_hCashPartsObject[Index]->FreeObject(); if( m_bCashSelfDelete[Index] ) { SAFE_RELEASE_SPTR( m_hCashPartsObject[Index] ); m_bCashSelfDelete[Index ] = false; } m_hCashPartsObject[Index].Identity(); return true; } void MAPartsBody::RefreshPartsViewOrder( int nEquipIndex ) { if( nEquipIndex < 0 || nEquipIndex >= CDnParts::SwapParts_Amount ) return; // Ŭ¶óÀÌ¾ðÆ®¿Í ´Þ¸® ¼î-ÇÏÀ̵å ó¸®ÇÒÇÊ¿ä ¾øÀ¸¹Ç·Î ¾Æ¹«ÀÏ ÇÏÁö ¾Ê´Â´Ù. }