/** * @file Objcet.cpp * @brief Object class * @author Unknown * @version Unknown */ //------------------------------------------------------------------------------ // Object.cpp // (C) 2005 Webzen Sunstudio //------------------------------------------------------------------------------ #include "SunClientPrecompiledHeader.h" #include "Object.h" #include "Character.h" #include "AppearanceManager.h" #include "ResourceManager.h" #include "SoundEffect.h" #include "Hero.h" #include "GameFunc.h" #include "MapResMgr.h" #include "interfacemanager.h" #include "GlobalFunc.h" #include "Camera.h" #include "OptimizationManager.h" #include "HeroActionInput.h" #include "Map.h" #include "GameFrameWork.h" #include "SceneBase.h" #include "EventInfo.h" #pragma warning ( push ) #pragma warning(disable : 4800) //------------------------------------------------------------------------------ /** */ Object::Object( void ) : m_bUseDelayLoading(false), m_bVisible(TRUE), m_bEnableDisplay(FALSE), m_pPathExplorer(NULL) { //for (int a= 0; a < MAX_TRAIL; a++) // { // m_bTrailActivate[a] = FALSE; // m_hTrailEffect[a] = INVALID_HANDLE_VALUE; //} //InitializeEffect(); } //------------------------------------------------------------------------------ /** */ Object::~Object( void ) { } //------------------------------------------------------------------------------ /** */ BOOL Object::Create( DWORD dwObjectKey, DWORD dwID ) { GetObjectData().Initialize(); //SetVector(&m_wvVisiblePos,0.0f,0.0f,0.0f); m_woiOctIndex = INVALID_WZOCTINDEX; SetObjectKey(dwObjectKey); m_pPathExplorer = GetObjectData().GetPathExplorer(); m_bAnimated = FALSE; //m_CurrentAnimID = 0; InitializeState(); InitializeEffect(); //#ifdef _PERF_DEBUG // m_pPathExplorer->SetSHCStatus(TRUE); //#endif return TRUE; } //------------------------------------------------------------------------------ void Object::Destroy() { DestroyAllEffect(); ReleaseRender(); RemoveObjectToOctree(); GetObjectData().Release(); } //------------------------------------------------------------------------------ void Object::InitRender( size_t MaxPartNum, size_t BasePart, APPEARANCEINFO* pAppearInfo, size_t iAttachmentCount, BOOL bMakeBoneOnly ) { ReleaseRender(); GetObjectData().InitializeRender( MaxPartNum, BasePart, pAppearInfo, iAttachmentCount ); if (pAppearInfo) { pAppearInfo->texture_rate = g_OptimizationManager.GetTextureRate(this); APPEARANCEMGR->SetAppearance(pAppearInfo,this,TRUE,bMakeBoneOnly); } GetObjectData().RefreshAniRefDraw(); } //------------------------------------------------------------------------------ // ¿¡´Ï¸ÞÀÌ¼Ç Á¤º¸ ¼¼ÆÃ //------------------------------------------------------------------------------ void Object::RefreshRender(APPEARANCEINFO* pAppearInfo,BOOL bRefreshBone) { assert(pAppearInfo); CWzUnitDraw** pParts = GetObjectData().GetRenderParts(); int nBasePartIndex = GetObjectData().GetBasePartIndex(); CWzUnitDraw* pBasePart = pParts[nBasePartIndex]; WzVector pos = pBasePart->GetPosition(); WzVector dir = pBasePart->GetRotation(); WzID ani = pBasePart->GetCurrentAnimation(); float frame = pBasePart->GetCurrentFrame(); bool is_loop = false; #if (WZENGINEVER >= 540) || defined(USING_MILKY_TRUNK_ENGINE) if( CWzAniState* ani_state = pBasePart->GetCurAniState() ) { is_loop = ani_state->GetAniLoop(); } #endif // °¢ ÆÄÆ® ÆÄ±« if (bRefreshBone) { if (pParts[nBasePartIndex]) { ResourceManager::Instance()->FreeResourceUnitDraw( pParts[nBasePartIndex] ); pParts[nBasePartIndex] = NULL; pBasePart = NULL; } } pAppearInfo->texture_rate = g_OptimizationManager.GetTextureRate(this); APPEARANCEMGR->SetAppearance(pAppearInfo,this,bRefreshBone,FALSE); pBasePart = pParts[nBasePartIndex]; GetObjectData().RefreshAniRefDraw(); if (pBasePart) { pBasePart->SetPosition(pos,FALSE); // ¹Ù¿îµù º¼·ýÀ» ¾µµ¥¾øÀÌ µÎ¹ø ¾÷µ«ÇÏÁö¾Ê´Â´Ù. pBasePart->SetRotation(dir.x,dir.y,dir.z,TRUE); } if (bRefreshBone)//¿¡´Ï¸ÞÀ̼ÇÁß¿¡ ¿¡´Ï¸ÞÀ̼ÇÀ» ¹Ù²Ü°æ¿ì ¹«ÇÑ ·çÇο¡ ºüÁø´Ù. { //m_CurrentAnimID = ani; pBasePart->SetCurrentAnimation(ani); pBasePart->SetFrame(frame); #if (WZENGINEVER > 540) || defined(USING_MILKY_TRUNK_ENGINE) if( CWzAniState* ani_state = pBasePart->GetCurAniState() ) { ani_state->SetAniLoop(is_loop); } #endif m_bAnimated = FALSE; } GetObjectData().EnableCustomLight( GetObjectData().IsCustomLight() ); GetObjectData().SetShadowDraw( GetObjectData().IsShadowDraw() ); } //------------------------------------------------------------------------------ void Object::ReleaseRender() { CWzUnitDraw** pParts = GetParts(); int nMaxPartNum = GetPartCount(); if( nMaxPartNum == 0 ) return; // °¢ ÆÄÆ® ÆÄ±« for( int i = 0 ; i < nMaxPartNum ; ++i ) { if (pParts[i]) { if ( IsKindOfObject(MAP_OBJECT) ) { MAPRESMGR()->RemoveUnitDraw( pParts[i] ); } else { if ( IsForceRemove() == true ) ResourceManager::Instance()->FreeResourceUnitDrawVer2( pParts[i], true); else ResourceManager::Instance()->FreeResourceUnitDraw( pParts[i] ); } pParts[i] = NULL; } } GetObjectData().ReleaseRender(); } //------------------------------------------------------------------------------ /** º» Á¤º¸¸¦ ¾ò¾î ºÎÂø¹° ¹× À¯´ÖÀ» ·£´õ ÇÑ´Ù. */ BOOL Object::Render() { if (!IsAnimated()) { AnimateUnit(); } if ( IsSimpleRenderMode() == TRUE ) { GetObjectData().RenderBasicParts( NULL ); return TRUE; } if( IsBodyOnlyRenderMode() == TRUE ) { GetObjectData().RenderPartsForCostume(); return TRUE; } GetObjectData().RenderParts( NULL ); return TRUE; } //------------------------------------------------------------------------------ /** */ BOOL Object::Render(St_RenderCommand *pCommand) { if (!IsAnimated()) { AnimateUnit(); } if ( IsSimpleRenderMode() == TRUE ) { GetObjectData().RenderBasicParts( pCommand ); return FALSE; } GetObjectData().RenderParts( pCommand ); return TRUE; } // // ////------------------------------------------------------------------------------ ///** // AttachmentµéÀ» º»¿¡ ºÙ¿©¼­ ¾Ö´Ï¸ÞÀÌ¼Ç ½ÃÄÑÁØ´Ù //*/ //void Object::ProcessAttachmentAnimation(DWORD dwTick) //{ // CWzUnitDraw* pSkeleton = GetBasePart(); // if( pSkeleton == NULL ) // return; // // // std::vector& AttachmentArray = GetObjectData().GetAttachmentArray(); // // for( size_t i=0;i!=AttachmentArray.size();++i) // { // AttachmentArray[i].ProcessAnimation( dwTick ); // } //} //------------------------------------------------------------------------------ /** ºÎÂøµÇÁö¾Ê¾Ò°Å³ª Á¦°ÅµÇ¾úÀ»°æ¿ì FALSE¸¦ ¸®ÅÏÇÑ´Ù */ BOOL Object::SetAttachment( size_t nIndex, const AttachmentInfo& AttacmentInfo, float fRequestRateResizeTexture ) { std::vector& AttachmentArray = GetObjectData().GetAttachmentArray(); if ( nIndex >= AttachmentArray.size() ) { return FALSE; } BOOL bPlayer = IsKindOfObject( PLAYER_OBJECT ) == TRUE; return AttachmentArray[nIndex].InitializeAttachment( bPlayer, AttacmentInfo, fRequestRateResizeTexture ); } //------------------------------------------------------------------------------ /** */ BOOL Object::DeleteAttachment(size_t nIndex) { std::vector& AttachmentArray = GetObjectData().GetAttachmentArray(); if ( nIndex >= AttachmentArray.size() ) { return FALSE; } return AttachmentArray[nIndex].ReleaseAttachment(); } //------------------------------------------------------------------------------ /** */ void Object::SetAnimation(const char* pAnimation, BOOL bLoop, BOOL bRestart) { SetAnimation(StrToWzID( pAnimation ), bLoop, bRestart); } //------------------------------------------------------------------------------ /** */ void Object::SetAnimation(WzID idAnimation, BOOL bLoop, BOOL bRestart) { #ifdef _DEBUG char str[256] = {NULL, }; WzIDToString( str, idAnimation ); if (Stricmp(str, "S418") == 0) { int a = 0; } #endif //_DEBUG if (!GetBasePart()) return; DestroyAllLoopEffect(); BOOL bNoBlend = FALSE; //BOOL bRestart = TRUE; if (bLoop) { bRestart = FALSE; } WzID CurrentAnimation = GetCurrentAnimation(); // ÀÓ½Ã! // ÀÌÀü¾Ö´Ï°¡ Á×´Â ¾Ö´Ï¿´À¸¸é ºí·»µùÀ» ÇÏÁö¾Ê´Â´Ù. if (CurrentAnimation == StrToWzID("D001")|| CurrentAnimation == StrToWzID("D002")|| CurrentAnimation == StrToWzID("D003")) { bNoBlend = TRUE; } if(IsKindOfObject(MAP_OBJECT)) { bNoBlend = TRUE; } if (CurrentAnimation == 0) { bNoBlend = TRUE; } // ¶È°°Àº ¾Ö´ÏÀ̸鼭 LoopÀÌ¸é ±×³É ¾Æ¹«°Íµµ ¾ÈÇÑ´Ù. if (CurrentAnimation == idAnimation && bLoop ) { return; } GetBasePart()->SetCurrentAnimation( idAnimation, bLoop , bRestart); WzAnimationInfo *pInfo = GetBasePart()->GetCurrentAnimationInfo(); if( pInfo == NULL ) { GetBasePart()->SetCurrentAnimation( idAnimation, bLoop , bRestart); } else { // ¾Ö´Ï¸¦ ãÁö ¸øÇßÀ»°æ¿ì ¾Æ¹« ¾Ö´Ï¸ÞÀ̼ÇÀ̳ª Ç÷¹ÀÌ ÇØÁØ´Ù. if( pInfo->m_wiAction != idAnimation ) { if (GetBasePart()->GetWzUnit() != NULL) { pInfo = GetBasePart()->GetWzUnit()->GetAnimationInfoByIndex(0); // ¾Ö´Ï¸ÞÀ̼ÇÀÌ ¿ÏÀüÈ÷ ¾ø´Â °æ¿ì´Â ¾î¿¼ö¾ø´Ù. if (pInfo) { GetBasePart()->SetCurrentAnimation( pInfo->m_wiAction, bLoop , bRestart); } } } } if (bNoBlend) { GetBasePart()->SetInterpolationFrame(0); } m_bAniProcessed = FALSE; } //------------------------------------------------------------------------------ /** */ void Object::SetCurrentBlendAnimation(char *pAnimation, int boneindex, float fSpeed, int iBlendFrame, BOOL bDelta ) { SetCurrentBlendAnimation( StrToWzID( pAnimation ), boneindex, fSpeed, iBlendFrame, bDelta); } //------------------------------------------------------------------------------ /** */ void Object::SetCurrentBlendAnimation(WzID idAnimation,int boneindex ,float fSpeed,int iBlendFrame,BOOL bDelta) { CWzUnit* pUnit=GetBasePart()->GetWzUnit(); if(!pUnit) return; WzAnimationInfo *pAnimationInfo =pUnit->GetAnimationInfo(idAnimation); if(!pAnimationInfo) { return; } if(pAnimationInfo->m_wiAction!=idAnimation) { return; } if (GetBasePart()->GetBlendAniCount() > 0) { return; } if (GetBasePart()->GetBlendAniCount() > 0) { GetBasePart()->UnSetBlendAnimation(); } if (idAnimation != 0) { if (iBlendFrame == -1) { GetBasePart()->SetBlendInterpolationFrame(-1, -1); } else { GetBasePart()->SetBlendInterpolationFrame(iBlendFrame,iBlendFrame); } } GetBasePart()->SetCurrentBlendAnimation(idAnimation, boneindex, FALSE, fSpeed,bDelta); m_bAniProcessed = FALSE; } //------------------------------------------------------------------------------ void Object::SetCurrentFrame(float fFrame) { if( CWzUnitDraw* pPart = GetBasePart() ) { pPart->SetFrame( fFrame ); } } size_t Object::GetAnimationCount() { if( CWzUnitDraw* pPart = GetBasePart() ) { if( CWzUnit* pUnit = pPart->GetWzUnit() ) { return pUnit->GetCountAnimationInfo(); } } return 0; } WzID Object::GetCurrentAnimation() { return GetBasePart() ? GetBasePart()->GetCurrentAnimation() : 0; } float Object::GetCurrentFrame() { return GetBasePart() ? GetBasePart()->GetFrame() : 0.0f; } WzBoundingVolume* Object::GetBoundingVolume() { return GetBasePart() ? GetBasePart()->GetBoundingVolumePtr() : NULL; } //------------------------------------------------------------------------------ /** */ float Object::GetTotalFrame() { if( WzAnimationInfo* pInfo = GetBasePart()->GetCurrentAnimationInfo() ) { return (float)(pInfo->m_nMaxFrame); } return 0.0f; } //------------------------------------------------------------------------------ float Object::ProcessAnimation( DWORD dwTick ,WzEvent *pEvent,BOOL bIgnoreEvent) { // ¸ÞÀÎÆÄÃ÷ À¯È¿Ã¼Å© if (GetBasePart() == NULL) { return 0.0f; } static WzEvent ani_event; ZeroMemory(&ani_event, sizeof(ani_event)); // ¾Ö´Ï¸ÞÀÌ¼Ç ÇÁ·¹ÀÓó¸® (Event¸¦¹Þ¾Æ¼­ ÀÌÆåÆ®,»ç¿îµå,Ä¿½ºÅÒµîó¸®) g_pSunRenderer->ProgressUnitFrame(GetBasePart(), (float)dwTick, &ani_event, ¤t_ani_progress_rate_); ProcessAttachmentAnimation(dwTick); EventInfo event_info(ani_event); #ifdef _DEV_VER if( event_info.IsGood() == false ) { if ( CWzUnitDraw* pBase = GetBasePart() ) { if( WzAnimationInfo* pAnimationInfo = pBase->GetCurrentAnimationInfo() ) { GlobalFunc::OutputMsg_Notice(eOUTPUT_MSG_CHAT, _T("event_max: %s"), pAnimationInfo->m_lpszFileName); } } } #endif // _DEV_VER // »ç¿îµåÀ̺¥Æ®Ã³¸® if ((dwTick != 0) && ((g_pHero != this) || (g_pHero->GetShow() == TRUE))) { // ÁÖÀΰø º¸À϶§¸¸ const size_t event_count = event_info.GetSoundEventCount(); for (size_t i = 0; i != event_count; ++i) { ProcessSoundEvent(event_info.GetSoundEvent(i), GetVisiblePos()); } } // À̺¥Æ®¹«½Ã üũ if (bIgnoreEvent == FALSE) { // ÀÌÆåÆ® À̺¥Æ® DWORD object_key = IsKindOfObject(MAP_OBJECT) ? (0) : (GetObjectKey()); const size_t event_count = event_info.GetEffectEventCount(); for (size_t i = 0; i != event_count; ++i) { const EffectEventInfo& info = event_info.GetEffectEvent(i); if ((IsAnimated() == TRUE) || (info.IsTrail_LeftToRight() && info.IsDestroy()) || (info.IsTrail_RightToLeft() && info.IsDestroy()) || (info.IsDestroyAll() == true) || (info.IsDestroy() == true)) { } else { AnimateUnit(); } ProcessEffectEvent(event_info.GetEffectEvent(i), GetBasePart(), GetVisiblePos(), GetDirection(), object_key); } // Ä¿½ºÅÒ À̺¥Æ® if (ani_event.m_iNumCustom > 0) { const size_t event_count = event_info.GetCustomEventCount(); for (size_t i = 0; i != event_count; ++i) { ProcessCustomEvent(event_info.GetCustomEvent(i), GetPosition()); } } } OnWaterEllipse(); if (pEvent != NULL) { *pEvent = ani_event; } m_bAnimated = FALSE; m_bAniProcessed = TRUE; return current_ani_progress_rate_; } //------------------------------------------------------------------------------ WzAnimationInfo* Object::GetAnimationInfo(WzID animation) { if (GetBasePart() && GetBasePart()->GetWzUnit()) { return GetBasePart()->GetWzUnit()->GetAnimationInfo(animation); } return NULL; } //------------------------------------------------------------------------------ WzID Object::GetTrailEffectCode() { return StrToWzID("arrw"); } // ////------------------------------------------------------------------------------ //void Object::StartTrail(int TrailIndex, const TRAIL_PARAM& TrailParam) //{ // if (!IsAnimated()) // { // AnimateUnit(); // } // // assert(TrailIndex >= 0 && TrailIndex < MAX_TRAIL); // EndTrail(TrailIndex); // // if (g_pEffectManager) // { // HANDLE hEffect = GlobalFunc::CreateEffectBeUpToOption( // GetTrailEffectCode(), // GetTrailBonePos(TrailIndex,1), // GetObjectKey()); // // m_EffectData.StartTrail( TrailIndex, TrailParam, hEffect ); // } // // UpdateTrail(); //} // ////------------------------------------------------------------------------------ //void Object::EndTrail(int TrailIndex) //{ // m_EffectData.EndTrail( TrailIndex ); //} // ////------------------------------------------------------------------------------ //void Object::UpdateTrail() //{ // for( int i=0; i < m_EffectData.GetTrailCount(); ++i ) // { // if( m_EffectData.IsEnableTrail(i) == false ) // continue; // // m_EffectData.UpdateTrail( i, GetTrailBonePos(i,1), GetTrailBonePos(i,0) ); // } //} //------------------------------------------------------------------------------ WzVector Object::GetTrailBonePos(int index,int start) { WzVector vRet; ZeroMemory(&vRet,sizeof(vRet)); const std::vector& AttachmentArray = GetObjectData().GetAttachmentArray(); if( AttachmentArray.empty() == false ) { int iAttachIndex = effectdata().GetTrailAttachmentIndex( index ); iAttachIndex=min( iAttachIndex, (int)AttachmentArray.size()-1); iAttachIndex=max( 0, iAttachIndex ); int startboneindex = 3; int endboneindex = 4; if( CWzUnitDraw* pSkeleton = AttachmentArray[iAttachIndex].GetUnitDraw() ) { if (pSkeleton->GetWzUnit() != NULL) { WzBoneInfo* pBoneInfo = pSkeleton->GetWzUnit()->GetBoneInfo(StrToWzID("EFF1")); if (pBoneInfo) { startboneindex = pBoneInfo->m_iNode; } pBoneInfo = pSkeleton->GetWzUnit()->GetBoneInfo(StrToWzID("EFF2")); if (pBoneInfo) { endboneindex = pBoneInfo->m_iNode; } int boneindex; if (start) { boneindex = startboneindex; } else { boneindex = endboneindex; } GameFunc::GetBonePos( pSkeleton, boneindex, &vRet ); } } } return vRet; } //------------------------------------------------------------------------------ /** */ void Object::AnimateUnit() { SUNPROFILE_BEGIN( _T("AnimateUnit") ); CWzUnitDraw* pBasePart = GetBasePart(); if (pBasePart == NULL) { SUNPROFILE_END( _T("AnimateUnit") ); return; } if (m_bAniProcessed == FALSE) { ProcessAnimation(0, NULL, TRUE); } CWzUnitDraw** pParts = GetParts(); int nPartCount = GetPartCount(); g_pSunRenderer->AnimateUnit(pBasePart); for (int i = 1; i < nPartCount; ++i) { if ( pParts[i] != NULL) { g_pSunRenderer->AnimateUnit( pParts[i] ); } } //¹Ýµå½Ã ¸ÞÀÎÆÄÃ÷ÈÄ¿¡ È£ÃâµÇ¾î¾ßµÊ if( pBasePart != NULL ) { std::vector& AttachmentArray = GetObjectData().GetAttachmentArray(); for( size_t i=0;i!=AttachmentArray.size();++i) { AttachmentArray[i].Animate( pBasePart, GetVisiblePos(), GetHeightOffset() ); } } m_bAnimated = TRUE; UpdateTrail(); //UpdateEffectPos(); UpdateEffectPos(GetBasePart(), GetVisiblePos(), GetDirection()); SUNPROFILE_END( _T("AnimateUnit") ); } // ////------------------------------------------------------------------------------ ///** //*/ //void Object::InitializeEffect() //{ // m_EffectData.Initialize(); //} ////------------------------------------------------------------------------------ ///** //*/ //void Object::DestroyAllLoopEffect() //{ // m_EffectData.ReleaseLoopEffect(); //} // ////------------------------------------------------------------------------------ ///** //*/ //void Object::DestroyObjectEffect(int index,int iBuffer) //{ // m_EffectData.ReleaseEffect( index, iBuffer ); //} // ////------------------------------------------------------------------------------ ///** //*/ //void Object::DestroyAllEffect() //{ // m_EffectData.ReleaseAllEffect(); //} ////------------------------------------------------------------------------------ ///** //*/ //void Object::MoveRemainEffect(int index) //{ // m_EffectData.ReleaseCurEffect(index); //} //------------------------------------------------------------------------------ /** */ WzVector Object::GetBonePos(int index) { if (!IsAnimated()) { AnimateUnit(); } WzVector vRet; SetVector(&vRet, 0.f, 0.f, 0.f); vRet = GetVisiblePos(); CWzUnitDraw* pSkeleton = GetBasePart(); GameFunc::GetBonePos(pSkeleton,index,&vRet); return vRet; } //------------------------------------------------------------------------------ /** */ WzVector Object::GetSpecialBonePos(WzID id) { int iNode = 0; if (GetBasePart()->GetWzUnit() != NULL) { if (WzBoneInfo* pInfo = GetBasePart()->GetWzUnit()->GetBoneInfo(id)) { iNode = pInfo->m_iNode; } } return GetBonePos(iNode); } //------------------------------------------------------------------------------ /** */ WzMatrix Object::GetBoneMatrix(int index) { if (!IsAnimated()) { AnimateUnit(); } WzMatrix matRet; MatrixIdentity( &matRet ); if( CWzUnitDraw* pSkeleton = GetBasePart() ) { WzMatrix *pBoneMatrix = pSkeleton->GetTransformBuffer(); if(pBoneMatrix && index >= 0 && pSkeleton->GetTransformBufferSize() > index ) // jjumbo: index°¡ À½¼ö³ª ¹üÀ§¸¦ ³Ñ¾î°¡¸é »¸´ø°Í ¼öÁ¤. { matRet = pBoneMatrix[index]; } } return matRet; } //------------------------------------------------------------------------------ /** */ void Object::StopBlendAnimation() { if ( CWzUnitDraw* pBasePart = GetBasePart() ) { if( pBasePart->GetBlendAniCount() > 0 ) { pBasePart->UnSetBlendAnimation(); } } } //------------------------------------------------------------------------------ /** º» Á¤º¸¸¦ ¾ò¾î ºÎÂø¹° ¹× À¯´ÖÀ» ·£´õ ÇÑ´Ù. - remark - SetColor ¸Þ¼Òµå¸¦ Ãß°¡ÇÔ. */ BOOL Object::RenderOutline( const WzColor& color , float fThickness) { if (!IsAnimated()) { AnimateUnit(); } if( St_Camera* pCameraInfo = g_pSunRenderer->GetCameraInfo() ) { WzVector vOffset = pCameraInfo->m_wvFrom - (this->GetPosition()); float fRange = VectorLength(&vOffset); if (fRange >= 7.f && fRange < 15.f) { fThickness = fThickness * 2.f; } else if (fRange >= 15.f && fRange < 20.f) { fThickness = fThickness * 3.f; } else if (fRange >= 20.f && fRange < 30.f) { fThickness = fThickness * 5.f; } else if (fRange >= 30.f && fRange < 50.f) { fThickness = fThickness * 8.f; } else if (fRange >= 50.f) { fThickness = fThickness * 15.f; } else { fThickness = fThickness * 1.f; } } if (IsBodyOnlyRenderMode() == TRUE) { return GetObjectData().RenderOutlineForCostume( color, fThickness ); } else { return GetObjectData().RenderOutline( color, fThickness ); } } ////------------------------------------------------------------------------------ ///** //*/ //void Object::UpdateEffectPos() //{ // m_EffectData.UpdateEffect( GetBasePart(), GetVisiblePos(), GetDirection() ); //} //------------------------------------------------------------------------------ /** */ void Object::RenderInfo() { WzVector ChatPosition = GetVisiblePos(); ChatPosition.z += GetMeshHeight(); ChatPosition.z += 0.1f; ObjectChatData::RenderChatMessage( ChatPosition ); } //------------------------------------------------------------------------------ /** */ float Object::GetMeshHeight() { return 0.0f; } //------------------------------------------------------------------------------ /** */ BOOL Object::Process(DWORD dwTick) { ProcessChatTime( dwTick ); return TRUE; } //------------------------------------------------------------------------------ /** */ void Object::SetShow(BOOL bFlag) { m_bVisible = bFlag; // À¯´Ö ÀÌÆåÆ® º¸À̱â/°¨Ãß±â SetSubTypeEffectShow( bFlag ); } //------------------------------------------------------------------------------ /** */ float Object::GetCurrentProgressRate() { float fTotalFrame = GetTotalFrame(); if (fTotalFrame >= 1.0f) { return (GetBasePart()->GetCurrentFrame() * 100.0f) / float(fTotalFrame-1); } else { return 0.0f; } } //------------------------------------------------------------------------------ /** ¿ÁÆ®¸®¿¡ (´Ù½Ã) Ãß°¡ÇÑ´Ù */ void Object::AddObjectToOctree() { RemoveObjectToOctree(); WzBoundingVolume* pBV = GetBoundingVolume(); m_woiOctIndex = g_pMap->GetWorldBase()->x_pOctree->AddObject( DTO_UNIT, GetObjectKey(), pBV ); } void Object::RemoveObjectToOctree() { if (m_woiOctIndex != INVALID_WZOCTINDEX) { if (g_pMap->GetWorldBase() != NULL) { g_pMap->GetWorldBase()->x_pOctree->RemoveObject(DTO_UNIT,GetObjectKey(),m_woiOctIndex); } m_woiOctIndex = INVALID_WZOCTINDEX; } } DWORD Object::GetCurrentTileAtt( BOOL bForce ) { if( CPathExplorer* pPathExplorer = GetObjectData().GetPathExplorer() ) { if( g_pMap != NULL ) { int iTile = m_pPathExplorer->GetTile(); if( iTile >= 0 ) return g_pMap->GetWorldBase()->x_pPathFinder->GetAttribute( iTile ); } } return 0; } //------------------------------------------------------------------------------ void Object::ProcessAttachmentAnimation(DWORD dwTick) { CWzUnitDraw* pSkeleton = GetBasePart(); if( pSkeleton == NULL ) return; std::vector& AttachmentArray = GetObjectData().GetAttachmentArray(); for( size_t i=0;i!=AttachmentArray.size();++i) { AttachmentArray[i].ProcessAnimation( dwTick ); } } // ////------------------------------------------------------------------------------ //// »ç¿îµå À̺¥Æ® ó¸® //void Object::ProcessSoundEvent(const SoundEventInfo& SoundEventInfo ) //{ // // ÁÖÀΰø º¸À϶§¸¸ // if ((g_pHero == this) && // (g_pHero->GetShow() == FALSE)) // { // return; // } // // g_SoundEffect.Play( SoundEventInfo.GetSoundIndex(), &GetVisiblePos() ); //} // // ////------------------------------------------------------------------------------ //// ÀÌÆåÆ® À̺¥Æ® ó¸® //void Object::ProcessEffectEvent(const EffectEventInfo& EffectEventInfo) //{ // if( EffectEventInfo.IsTrail_LeftToRight() == true ) // { // if( EffectEventInfo.IsDestroy() ) // { // EndTrail(1); // } // else // { // TRAIL_PARAM param; // param.iAttachmentIndex = 1; // param.iTailNum = 40; // StartTrail(1, param); // } // } // else if( EffectEventInfo.IsTrail_RightToLeft() == true ) // { // if( EffectEventInfo.IsDestroy() ) // { // EndTrail(0); // } // else // { // TRAIL_PARAM param; // param.iAttachmentIndex = 0; // param.iTailNum = 40; // StartTrail(0, param); // } // } // else if( EffectEventInfo.IsDestroyAll() == true ) // { // // ¸ðµç ÀÌÆåÆ® »èÁ¦ // DestroyAllEffect(); // } // else if( EffectEventInfo.IsDestroy() == true ) // { // // ·çÇÁ°¡ ¾Æ´Ñ°æ¿ì ¹Ù·ÎÁ×ÀÌÁö¾Ê°í ÀÚ¿¬½º·¹ Á×À̱âÀ§ÇØ ¿Å°Ü³õ±â // MoveRemainEffect( EffectEventInfo.GetEventIndex() ); // // // ÇØ´ç ÀÌÆåÆ® »èÁ¦ // DestroyObjectEffect( EffectEventInfo.GetEventIndex(), CUR_EFFECT); // } // else // { // if (!IsAnimated()) // { // AnimateUnit(); // } // // m_EffectData.BeginEffect( GetBasePart(), GetVisiblePos(), GetDirection(), EffectEventInfo, IsKindOfObject(MAP_OBJECT) ? (0) : (GetObjectKey()) ); // } //} // ////------------------------------------------------------------------------------ //// Ä¿½ºÅÒ À̺¥Æ® ó¸® //void Object::ProcessCustomEvent( const CustomEventInfo& Info ) //{ // if( Info.IsFootStep() == true ) // { // OnFootStep(); // } // else if( Info.IsWaterWave() == true ) // { // OnWaterWave(); // } // else if( Info.IsCameraWave() == true ) // { // if ( g_pHero != NULL ) // { // WzVector distance = g_pHero->GetPosition() - GetPosition(); // if ( VectorLength(&distance) > 15.f ) // { // return; // } // // g_Camera.SetVibeType(Camera::VIBE_TYPE_ALL); // g_Camera.StartVibration( Info.GetCameraWaveDuration(), Info.GetCameraWavePower() ); // } // } //} #pragma warning ( pop )