Add AVA2-style display options (effect level, trees, clouds)
Client-only port of ENABLE_GRAPHIC_ON_OFF / HIDE_OBJECTS: five effect levels toggle attached actor effects via Active/Deactive, tree and cloud parts use background.SetVisiblePart, plus shortcuts for the original name and damage options. mt_display window, mt_display.cfg, port.display test, docs/AVA2-DISPLAY.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e22d7ba6fd
commit
e546f91e03
@@ -320,6 +320,8 @@ if(BUILD_TESTING AND CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
|
||||
COMMAND ${MT_WIKI_PYTHON3} ${PROJECT_SOURCE_DIR}/tests/wiki/test_switchbot.py)
|
||||
add_test(NAME port.pickup
|
||||
COMMAND ${MT_WIKI_PYTHON3} ${PROJECT_SOURCE_DIR}/tests/wiki/test_pickup.py)
|
||||
add_test(NAME port.display
|
||||
COMMAND ${MT_WIKI_PYTHON3} ${PROJECT_SOURCE_DIR}/tests/wiki/test_display.py)
|
||||
endif()
|
||||
# Offline locale data builder: retains 40250 proto layout and gameplay fields.
|
||||
add_executable(locale_proto_patch ${PROJECT_SOURCE_DIR}/tests/port/locale_proto_patch.cpp)
|
||||
|
||||
@@ -252,6 +252,17 @@ void CEffectManager::DeactiveEffectInstance(DWORD dwInstanceIndex)
|
||||
pEffectInstance->SetDeactive();
|
||||
}
|
||||
|
||||
// PORT: AVA2 ENABLE_GRAPHIC_ON_OFF (display options effect level).
|
||||
void CEffectManager::ActiveEffectInstance(DWORD dwInstanceIndex)
|
||||
{
|
||||
TEffectInstanceMap::iterator itor = m_kEftInstMap.find(dwInstanceIndex);
|
||||
|
||||
if (itor == m_kEftInstMap.end())
|
||||
return;
|
||||
|
||||
itor->second->SetActive();
|
||||
}
|
||||
|
||||
void CEffectManager::CreateUnsafeEffectInstance(DWORD dwEffectDataID, CEffectInstance ** ppEffectInstance)
|
||||
{
|
||||
CEffectData * pEffect;
|
||||
|
||||
@@ -47,6 +47,7 @@ class CEffectManager : public CScreen, public CSingleton<CEffectManager>
|
||||
BOOL SelectEffectInstance(DWORD dwInstanceIndex);
|
||||
bool DestroyEffectInstance(DWORD dwInstanceIndex);
|
||||
void DeactiveEffectInstance(DWORD dwInstanceIndex);
|
||||
void ActiveEffectInstance(DWORD dwInstanceIndex); // PORT: AVA2 ENABLE_GRAPHIC_ON_OFF
|
||||
|
||||
void SetEffectTextures(DWORD dwID, std::vector<std::string> textures);
|
||||
void SetEffectInstancePosition(const D3DXVECTOR3 & c_rv3Position);
|
||||
|
||||
@@ -496,6 +496,9 @@ class CActorInstance : public IActorInstance, public IFlyTargetableObject
|
||||
float GetHeight();
|
||||
void ShowAllAttachingEffect();
|
||||
void HideAllAttachingEffect();
|
||||
// PORT: AVA2 ENABLE_GRAPHIC_ON_OFF. Deactivates (not hides) attached effects, so it does not fight
|
||||
// the assassin invisibility Show/Hide; effects attached while off start deactivated.
|
||||
void SetAttachingEffectShown(bool bShown);
|
||||
void ClearAttachingEffect();
|
||||
|
||||
// Fishing
|
||||
@@ -793,6 +796,7 @@ class CActorInstance : public IActorInstance, public IFlyTargetableObject
|
||||
// Attached Effect
|
||||
std::list<TAttachingEffect> m_AttachingEffectList;
|
||||
bool m_bEffectInitialized;
|
||||
bool m_bAttachingEffectShown = true;
|
||||
|
||||
// material color
|
||||
DWORD m_dwMtrlColor;
|
||||
|
||||
@@ -294,6 +294,8 @@ DWORD CActorInstance::AttachEffectByID(DWORD dwParentPartIndex, const char * c_p
|
||||
ae.iBoneIndex = -1;
|
||||
}
|
||||
|
||||
if (!m_bAttachingEffectShown)
|
||||
rkEftMgr.DeactiveEffectInstance(ae.dwEffectIndex);
|
||||
m_AttachingEffectList.push_back(ae);
|
||||
|
||||
return ae.dwEffectIndex;
|
||||
@@ -472,6 +474,8 @@ void CActorInstance::RefreshActorInstance()
|
||||
|
||||
ae.iBoneIndex = iBoneIndex;
|
||||
|
||||
if (!m_bAttachingEffectShown)
|
||||
CEffectManager::Instance().DeactiveEffectInstance(ae.dwEffectIndex);
|
||||
m_AttachingEffectList.push_back(ae);
|
||||
}
|
||||
break;
|
||||
@@ -593,6 +597,22 @@ void CActorInstance::HideAllAttachingEffect()
|
||||
}
|
||||
}
|
||||
|
||||
void CActorInstance::SetAttachingEffectShown(bool bShown)
|
||||
{
|
||||
if (m_bAttachingEffectShown == bShown)
|
||||
return;
|
||||
|
||||
m_bAttachingEffectShown = bShown;
|
||||
CEffectManager& rkEftMgr = CEffectManager::Instance();
|
||||
for (const TAttachingEffect& ae : m_AttachingEffectList)
|
||||
{
|
||||
if (bShown)
|
||||
rkEftMgr.ActiveEffectInstance(ae.dwEffectIndex);
|
||||
else
|
||||
rkEftMgr.DeactiveEffectInstance(ae.dwEffectIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void CActorInstance::__ClearAttachingEffect()
|
||||
{
|
||||
m_bEffectInitialized = false;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "PythonNonPlayer.h"
|
||||
#include "PythonPlayer.h"
|
||||
#include "PythonCharacterManager.h"
|
||||
#include "PythonSystem.h"
|
||||
#include "AbstractPlayer.h"
|
||||
#include "AbstractApplication.h"
|
||||
#include "Packet.h"
|
||||
@@ -1868,6 +1869,7 @@ void CInstanceBase::Update()
|
||||
{
|
||||
++ms_dwUpdateCounter;
|
||||
|
||||
__UpdateEffectShown();
|
||||
StateProcess();
|
||||
m_GraphicThingInstance.PhysicsProcess();
|
||||
m_GraphicThingInstance.RotationProcess();
|
||||
@@ -2454,6 +2456,25 @@ bool CInstanceBase::__IsInViewFrustum()
|
||||
return m_GraphicThingInstance.isShow();
|
||||
}
|
||||
|
||||
// PORT: AVA2 ENABLE_GRAPHIC_ON_OFF effect level, applied to attached effects (skills, buffs, refine glow).
|
||||
void CInstanceBase::__UpdateEffectShown()
|
||||
{
|
||||
const int iLevel = CPythonSystem::Instance().GetEffectLevel();
|
||||
bool isShown = true;
|
||||
if (iLevel == 4)
|
||||
isShown = false;
|
||||
else if (iLevel != 0 && !__IsMainInstance())
|
||||
{
|
||||
if (iLevel == 1)
|
||||
isShown = IsEnemy() || IsStone();
|
||||
else if (iLevel == 2)
|
||||
isShown = IsPC();
|
||||
else
|
||||
isShown = false;
|
||||
}
|
||||
m_GraphicThingInstance.SetAttachingEffectShown(isShown);
|
||||
}
|
||||
|
||||
bool CInstanceBase::__CanRender()
|
||||
{
|
||||
if (!__IsInViewFrustum())
|
||||
|
||||
@@ -407,6 +407,7 @@ class CInstanceBase
|
||||
protected:
|
||||
bool __IsExistMainInstance();
|
||||
bool __IsMainInstance();
|
||||
void __UpdateEffectShown();
|
||||
bool __MainCanSeeHiddenThing();
|
||||
float __GetBowRange();
|
||||
|
||||
|
||||
@@ -110,6 +110,9 @@ class CPythonSystem : public CSingleton<CPythonSystem>
|
||||
bool IsAlwaysShowName();
|
||||
bool IsShowDamage();
|
||||
bool IsShowSalesText();
|
||||
// PORT: AVA2 effect_level (0 all, 1 hide players/NPCs, 2 hide monsters/NPCs, 3 hide others, 4 hide all).
|
||||
int GetEffectLevel() { return m_iPortEffectLevel; }
|
||||
void SetEffectLevel(int iLevel) { m_iPortEffectLevel = iLevel < 0 || iLevel > 4 ? 0 : iLevel; }
|
||||
bool IsUseDefaultIME();
|
||||
bool IsNoSoundCard();
|
||||
bool IsAutoTiling();
|
||||
@@ -159,4 +162,5 @@ class CPythonSystem : public CSingleton<CPythonSystem>
|
||||
bool m_isInterfaceConfig;
|
||||
PyObject * m_poInterfaceHandler;
|
||||
TWindowStatus m_WindowStatus[WINDOW_MAX_NUM];
|
||||
int m_iPortEffectLevel = 0;
|
||||
};
|
||||
@@ -211,6 +211,22 @@ PyObject * systemSetShowSalesTextFlag(PyObject * poSelf, PyObject * poArgs)
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * systemSetEffectLevel(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int iLevel;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iLevel))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonSystem::Instance().SetEffectLevel(iLevel);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * systemGetEffectLevel(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
return Py_BuildValue("i", CPythonSystem::Instance().GetEffectLevel());
|
||||
}
|
||||
|
||||
PyObject * systemIsAlwaysShowName(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
return Py_BuildValue("i", CPythonSystem::Instance().IsAlwaysShowName());
|
||||
@@ -422,6 +438,8 @@ void initsystem()
|
||||
|
||||
{ "SetShowSalesTextFlag", systemSetShowSalesTextFlag, METH_VARARGS },
|
||||
{ "IsShowSalesText", systemIsShowSalesText, METH_VARARGS },
|
||||
{ "SetEffectLevel", systemSetEffectLevel, METH_VARARGS }, // PORT: AVA2
|
||||
{ "GetEffectLevel", systemGetEffectLevel, METH_VARARGS },
|
||||
|
||||
{ "GetShadowLevel", systemGetShadowLevel, METH_VARARGS },
|
||||
{ "SetShadowLevel", systemSetShadowLevel, METH_VARARGS },
|
||||
|
||||
Reference in New Issue
Block a user