From 55b2d704590ae4a011bcc2e740ad6c30026690ea Mon Sep 17 00:00:00 2001 From: Mind Rapist Date: Mon, 29 Dec 2025 00:21:32 +0200 Subject: [PATCH] MR-5: FlyTarget fixes --- README.md | 7 ++--- src/EffectLib/EffectManager.cpp | 11 ++++++++ src/EffectLib/EffectManager.h | 4 +++ src/GameLib/ActorInstanceRender.cpp | 12 ++++++++ src/GameLib/RaceMotionDataEvent.h | 8 +++--- .../PythonNetworkStreamPhaseGame.cpp | 28 +++++++++++++++++++ 6 files changed, 62 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1d1ca5f..94c0a82 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ This repository contains the source code necessary to compile the game client ex ## ๐Ÿ“‹ Changelog ### ๐Ÿ› Bug Fixes -* **Shaman Mounted Combat:** Fixed a bug that wrongly calculated Shaman characters mounted hits that didn't collide with the target to cause damage when attack speed was had an extremely high value. -* **Invisibility VFX Logic:** Fixed an issue where skill visual effects remained visible to the character while under the `AFFECT_INVISIBLE` state. -* **Buff Effects Visibility Recovery:** Fixed an issue where buff skill visual effects remained invisible if the skill was cast while the character was under the `AFFECT_INVISIBLE` state. -* **Casting Speed Cooldowns:** Fixed an issue where Casting Speed was not properly calculated in skill cooldowns. The system now supports real-time calculation updates whenever the bonus value changes. +* **Debug mode:** Fly effects are now registering when using Debug mode. +* **Fix effect rendering in low opacity models:** Effects now appear normally on semi-transparent meshes. +* **Fly targeting fixed for buff/healing skills:** Fixed an issue where fly target effect would render in the buffer's selected target even if the target was unbuffable (if viewing from another client). diff --git a/src/EffectLib/EffectManager.cpp b/src/EffectLib/EffectManager.cpp index 2037c39..de393cb 100644 --- a/src/EffectLib/EffectManager.cpp +++ b/src/EffectLib/EffectManager.cpp @@ -351,6 +351,17 @@ void CEffectManager::HideEffect() m_pSelectedEffectInstance->Hide(); } +// MR-5: Fix effect rendering when actor is semi-transparent +// Credits to d1str4ught +void CEffectManager::RenderEffect() +{ + if (!m_pSelectedEffectInstance) + return; + + m_pSelectedEffectInstance->Render(); +} +// MR-5: -- END OF -- Fix effect rendering when actor is semi-transparent + void CEffectManager::ApplyAlwaysHidden() { if (!m_pSelectedEffectInstance) diff --git a/src/EffectLib/EffectManager.h b/src/EffectLib/EffectManager.h index fb7e245..0014cef 100644 --- a/src/EffectLib/EffectManager.h +++ b/src/EffectLib/EffectManager.h @@ -56,6 +56,10 @@ class CEffectManager : public CScreen, public CSingleton void ShowEffect(); void HideEffect(); + // MR-5: Fix effect rendering when actor is semi-transparent + // Credits to d1str4ught + void RenderEffect(); + // MR-5: -- END OF -- Fix effect rendering when actor is semi-transparent void ApplyAlwaysHidden(); void ReleaseAlwaysHidden(); diff --git a/src/GameLib/ActorInstanceRender.cpp b/src/GameLib/ActorInstanceRender.cpp index d0f608f..81066f0 100644 --- a/src/GameLib/ActorInstanceRender.cpp +++ b/src/GameLib/ActorInstanceRender.cpp @@ -32,6 +32,18 @@ void CActorInstance::SetMaterialAlpha(DWORD dwAlpha) void CActorInstance::OnRender() { + // MR-5: Fix effect rendering when actor is semi-transparent + // Credits to d1str4ught + if (GetAlphaValue() < 1.0f) + { + for (auto it = m_AttachingEffectList.begin(); it != m_AttachingEffectList.end(); ++it) + { + CEffectManager::Instance().SelectEffectInstance(it->dwEffectIndex); + CEffectManager::Instance().RenderEffect(); + } + } + // MR-5: -- END OF -- Fix effect rendering when actor is semi-transparent + D3DMATERIAL9 kMtrl; STATEMANAGER.GetMaterial(&kMtrl); diff --git a/src/GameLib/RaceMotionDataEvent.h b/src/GameLib/RaceMotionDataEvent.h index 4503c9c..703165b 100644 --- a/src/GameLib/RaceMotionDataEvent.h +++ b/src/GameLib/RaceMotionDataEvent.h @@ -147,9 +147,9 @@ namespace NMotionEvent isFishingEffect = FALSE; } dwEffectIndex = GetCaseCRC32(strEffectFileName.c_str(), strEffectFileName.length()); -#ifndef _DEBUG +// #ifndef _DEBUG CEffectManager::Instance().RegisterEffect(strEffectFileName.c_str()); -#endif +// #endif return true; } @@ -188,10 +188,10 @@ namespace NMotionEvent return false; dwFlyIndex = GetCaseCRC32(strFlyFileName.c_str(), strFlyFileName.length()); -#ifndef _DEBUG +// #ifndef _DEBUG // Register Fly CFlyingManager::Instance().RegisterFlyingData(strFlyFileName.c_str()); -#endif +// #endif return true; } diff --git a/src/UserInterface/PythonNetworkStreamPhaseGame.cpp b/src/UserInterface/PythonNetworkStreamPhaseGame.cpp index f04ca00..7d535b2 100644 --- a/src/UserInterface/PythonNetworkStreamPhaseGame.cpp +++ b/src/UserInterface/PythonNetworkStreamPhaseGame.cpp @@ -1142,10 +1142,38 @@ bool CPythonNetworkStream::SendCharacterStatePacket(const TPixelPosition& c_rkPP // NOTE : SlotIndex๋Š” ์ž„์‹œ bool CPythonNetworkStream::SendUseSkillPacket(DWORD dwSkillIndex, DWORD dwTargetVID) { + // tw1x1 fix wrong fly targeting for viewing clients + if (dwTargetVID) + { + CPythonCharacterManager& rpcm = CPythonCharacterManager::Instance(); + CInstanceBase* pTarget = rpcm.GetInstancePtr(dwTargetVID); + + if (pTarget) + { + TPixelPosition kPos; + + pTarget->NEW_GetPixelPosition(&kPos); + SendFlyTargetingPacket(dwTargetVID, kPos); + } + else + { + TPixelPosition kPos; + + kPos.x = 0; + kPos.y = 0; + kPos.z = 0; + + SendFlyTargetingPacket(0, kPos); + } + } + // END OF tw1x1 fix wrong fly targeting for viewing clients + TPacketCGUseSkill UseSkillPacket; + UseSkillPacket.bHeader = HEADER_CG_USE_SKILL; UseSkillPacket.dwVnum = dwSkillIndex; UseSkillPacket.dwTargetVID = dwTargetVID; + if (!Send(sizeof(TPacketCGUseSkill), &UseSkillPacket)) { Tracen("CPythonNetworkStream::SendUseSkillPacket - SEND PACKET ERROR");