Various fixes

This commit is contained in:
Mind Rapist
2026-02-15 21:40:52 +02:00
parent fb48dbc9ce
commit 74a93ad116
9 changed files with 77 additions and 23 deletions

View File

@@ -15,23 +15,11 @@ This repository contains the source code necessary to compile the game client ex
--- ---
## 📋 Changelog ## 📋 Changelog
### 🐛 Bug fixes
### ⬆️ Feature Improvements - **TempTrace**: Added `n` support for Python
- **Packet dump has its own log file**: The debug process now generates 4 log files: - **Togglable slots**: Fixed slots not deactivating on death
- `log.txt`: What you know and love, minus packet dumps - **Affects**: Added affect shower support for Mall Attack Speed
- `syserr.txt`: What you know and hate to see, as you know and hate it! - **Specular**: Fixed a bug where specular would not isolate to the targeted item. Swapping for example to a weapon with different specular would cause all surrounding weapon meshes to change specular as well. The issue has been fixed.
- `packetdump.txt`: All packet dumps go here
- `pdlog.txt`: The complete log with everything included
- **Console outputs are now colored!**: Not a big difference, red for syserr outputs, dimmer color for packet dumps.
- **TempTrace**: A type of output made to stand out in the console! Made to be used as a temporary debugging helper, it has blue background so you can easily spot it in the console. It logs normally in files and it is exported to the Python system via the C++ API!
Available C++ calls:
- `TraceTemp`
- `TraceTempf`
- `TraceTempn`
- `TraceTempfn`
Available Python calls:
- `TempTrace`
Usage: same as `Trace(f/n/fn)`, and `ErrorTrace` for Python
<br> <br>
<br> <br>

View File

@@ -148,6 +148,7 @@ LPDIRECT3DTEXTURE9 CGrannyMaterial::GetD3DTexture(int iStage) const
CGraphicImage * pImage = ratImage.GetPointer(); CGraphicImage * pImage = ratImage.GetPointer();
const CGraphicTexture * pTexture = pImage->GetTexturePointer(); const CGraphicTexture * pTexture = pImage->GetTexturePointer();
return pTexture->GetD3DTexture(); return pTexture->GetD3DTexture();
} }
@@ -183,10 +184,12 @@ BOOL CGrannyMaterial::__IsSpecularEnable() const
return m_bSpecularEnable; return m_bSpecularEnable;
} }
float CGrannyMaterial::__GetSpecularPower() const // MR-12: Fix specular isolation issue
float CGrannyMaterial::GetSpecularPower() const
{ {
return m_fSpecularPower; return m_fSpecularPower;
} }
// MR-12: -- END OF -- Fix specular isolation issue
extern const std::string& GetModelLocalPath(); extern const std::string& GetModelLocalPath();
@@ -316,7 +319,9 @@ void CGrannyMaterial::__ApplySpecularRenderState()
else else
STATEMANAGER.SetTexture(1, NULL); STATEMANAGER.SetTexture(1, NULL);
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, D3DXCOLOR(g_fSpecularColor.r, g_fSpecularColor.g, g_fSpecularColor.b, __GetSpecularPower())); // MR-12: Fix specular isolation issue
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, D3DXCOLOR(g_fSpecularColor.r, g_fSpecularColor.g, g_fSpecularColor.b, GetSpecularPower()));
// MR-12: -- END OF -- Fix specular isolation issue
STATEMANAGER.SaveTextureStageState(1, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR); STATEMANAGER.SaveTextureStageState(1, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR);
STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE); STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);

View File

@@ -60,6 +60,12 @@ class CGrannyMaterial : public CReferenceObject
LPDIRECT3DTEXTURE9 GetD3DTexture(int iStage) const; LPDIRECT3DTEXTURE9 GetD3DTexture(int iStage) const;
// MR-12: Fix specular isolation issue
float GetSpecularPower() const;
bool IsSpecularEnabled() const { return m_bSpecularEnable; }
BYTE GetSphereMapIndex() const { return m_bSphereMapIndex; }
// MR-12: -- END OF -- Fix specular isolation issue
bool IsTwoSided() const { return m_bTwoSideRender; } bool IsTwoSided() const { return m_bTwoSideRender; }
@@ -67,7 +73,6 @@ class CGrannyMaterial : public CReferenceObject
CGraphicImage * __GetImagePointer(const char * c_szFileName); CGraphicImage * __GetImagePointer(const char * c_szFileName);
BOOL __IsSpecularEnable() const; BOOL __IsSpecularEnable() const;
float __GetSpecularPower() const;
void __ApplyDiffuseRenderState(); void __ApplyDiffuseRenderState();
void __RestoreDiffuseRenderState(); void __RestoreDiffuseRenderState();

View File

@@ -17,6 +17,8 @@ void CGrannyModelInstance::SetMaterialImagePointer(const char* c_szImageName, CG
void CGrannyModelInstance::SetMaterialData(const char* c_szImageName, const SMaterialData& c_rkMaterialData) void CGrannyModelInstance::SetMaterialData(const char* c_szImageName, const SMaterialData& c_rkMaterialData)
{ {
m_kMtrlPal.SetMaterialData(c_szImageName, c_rkMaterialData); m_kMtrlPal.SetMaterialData(c_szImageName, c_rkMaterialData);
material_data_ = c_rkMaterialData;
} }
void CGrannyModelInstance::SetSpecularInfo(const char* c_szMtrlName, BOOL bEnable, float fPower) void CGrannyModelInstance::SetSpecularInfo(const char* c_szMtrlName, BOOL bEnable, float fPower)
@@ -87,6 +89,7 @@ void CGrannyModelInstance::__Initialize()
{ {
m_pModel->Release(); m_pModel->Release();
} }
m_pModel = NULL; m_pModel = NULL;
mc_pParentInstance = NULL; mc_pParentInstance = NULL;
m_iParentBoneIndex = 0; m_iParentBoneIndex = 0;
@@ -106,8 +109,10 @@ void CGrannyModelInstance::__Initialize()
m_pgrnCtrl = NULL; m_pgrnCtrl = NULL;
m_pgrnAni = NULL; m_pgrnAni = NULL;
m_dwOldUpdateFrame=0; // MR-12: Fix specular isolation issue
material_data_ = {};
m_dwOldUpdateFrame = 0;
// MR-12: -- END OF -- Fix specular isolation issue
} }
CGrannyModelInstance::CGrannyModelInstance() CGrannyModelInstance::CGrannyModelInstance()

View File

@@ -193,6 +193,9 @@ class CGrannyModelInstance : public CGraphicCollisionObject
// TEST // TEST
CGrannyModelInstance** m_ppkSkeletonInst; CGrannyModelInstance** m_ppkSkeletonInst;
// MR-12: Fix specular isolation issue
SMaterialData material_data_;
// MR-12: -- END OF -- Fix specular isolation issue
// END_OF_TEST // END_OF_TEST
#ifdef _TEST #ifdef _TEST
D3DXMATRIX TEST_matWorld; D3DXMATRIX TEST_matWorld;

View File

@@ -211,11 +211,21 @@ void CGrannyModelInstance::RenderMeshNodeListWithOneTexture(CGrannyMesh::EType e
///// /////
const CGrannyMesh::TTriGroupNode* pTriGroupNode = pMesh->GetTriGroupNodeList(eMtrlType); const CGrannyMesh::TTriGroupNode* pTriGroupNode = pMesh->GetTriGroupNodeList(eMtrlType);
int vtxCount = pMesh->GetVertexCount(); int vtxCount = pMesh->GetVertexCount();
while (pTriGroupNode) while (pTriGroupNode)
{ {
ms_faceCount += pTriGroupNode->triCount; ms_faceCount += pTriGroupNode->triCount;
CGrannyMaterial& rkMtrl=m_kMtrlPal.GetMaterialRef(pTriGroupNode->mtrlIndex); // MR-12: Fix specular isolation issue
CGrannyMaterial& rkMtrl = m_kMtrlPal.GetMaterialRef(pTriGroupNode->mtrlIndex);
if (!material_data_.pImage)
{
if (std::fabs(rkMtrl.GetSpecularPower() - material_data_.fSpecularPower) >= std::numeric_limits<float>::epsilon())
rkMtrl.SetSpecularInfo(material_data_.isSpecularEnable, material_data_.fSpecularPower, material_data_.bSphereMapIndex);
}
// MR-12: -- END OF -- Fix specular isolation issue
rkMtrl.ApplyRenderState(); rkMtrl.ApplyRenderState();
STATEMANAGER.DrawIndexedPrimitive(D3DPT_TRIANGLELIST, vtxMeshBasePos, 0, vtxCount, pTriGroupNode->idxPos, pTriGroupNode->triCount); STATEMANAGER.DrawIndexedPrimitive(D3DPT_TRIANGLELIST, vtxMeshBasePos, 0, vtxCount, pTriGroupNode->idxPos, pTriGroupNode->triCount);
rkMtrl.RestoreRenderState(); rkMtrl.RestoreRenderState();

View File

@@ -59,6 +59,16 @@ PyObject* dbgTraceTemp(PyObject* poSelf, PyObject* poArgs)
TempTrace(szMsg, false); TempTrace(szMsg, false);
return Py_BuildNone(); return Py_BuildNone();
} }
PyObject* dbgTraceTempn(PyObject* poSelf, PyObject* poArgs)
{
char* szMsg;
if (!PyTuple_GetString(poArgs, 0, &szMsg))
return Py_BuildException();
TempTracen(szMsg, false);
return Py_BuildNone();
}
// MR-11: -- END OF -- Temporary trace functions for debugging (not for regular logging) // MR-11: -- END OF -- Temporary trace functions for debugging (not for regular logging)
PyObject* dbgRegisterExceptionString(PyObject* poSelf, PyObject* poArgs) PyObject* dbgRegisterExceptionString(PyObject* poSelf, PyObject* poArgs)
@@ -83,6 +93,7 @@ void initdbg()
{ "TraceError", dbgTraceError, METH_VARARGS }, { "TraceError", dbgTraceError, METH_VARARGS },
// MR-11: Temporary trace functions for debugging (not for regular logging) // MR-11: Temporary trace functions for debugging (not for regular logging)
{ "TraceTemp", dbgTraceTemp, METH_VARARGS }, { "TraceTemp", dbgTraceTemp, METH_VARARGS },
{ "TraceTempn", dbgTraceTempn, METH_VARARGS },
// MR-11: -- END OF -- Temporary trace functions for debugging (not for regular logging) // MR-11: -- END OF -- Temporary trace functions for debugging (not for regular logging)
{ "RegisterExceptionString", dbgRegisterExceptionString, METH_VARARGS }, { "RegisterExceptionString", dbgRegisterExceptionString, METH_VARARGS },
{ NULL, NULL }, { NULL, NULL },

View File

@@ -2377,6 +2377,9 @@ void initPlayer()
PyModule_AddIntConstant(poModule, "ATTACKER_BONUS", POINT_PARTY_ATT_GRADE); PyModule_AddIntConstant(poModule, "ATTACKER_BONUS", POINT_PARTY_ATT_GRADE);
PyModule_AddIntConstant(poModule, "MAX_NUM", POINT_MAX_NUM); PyModule_AddIntConstant(poModule, "MAX_NUM", POINT_MAX_NUM);
//// ////
// MR-12: Add Mall Attack speed affect
PyModule_AddIntConstant(poModule, "POINT_ATT_SPEED", POINT_ATT_SPEED);
// MR-12: -- END OF -- Add Mall Attack speed affect
PyModule_AddIntConstant(poModule, "POINT_CRITICAL_PCT", POINT_CRITICAL_PCT); PyModule_AddIntConstant(poModule, "POINT_CRITICAL_PCT", POINT_CRITICAL_PCT);
PyModule_AddIntConstant(poModule, "POINT_PENETRATE_PCT", POINT_PENETRATE_PCT); PyModule_AddIntConstant(poModule, "POINT_PENETRATE_PCT", POINT_PENETRATE_PCT);
PyModule_AddIntConstant(poModule, "POINT_MALL_ATTBONUS", POINT_MALL_ATTBONUS); PyModule_AddIntConstant(poModule, "POINT_MALL_ATTBONUS", POINT_MALL_ATTBONUS);

View File

@@ -10,6 +10,30 @@
void CPythonPlayer::ClearAffects() void CPythonPlayer::ClearAffects()
{ {
PyCallClassMemberFunc(m_ppyGameWindow, "ClearAffects", Py_BuildValue("()")); PyCallClassMemberFunc(m_ppyGameWindow, "ClearAffects", Py_BuildValue("()"));
// MR-12: Deactivate all active toggle skills when affects are cleared (e.g., on death)
for (int i = 0; i < SKILL_MAX_NUM; ++i)
{
TSkillInstance & rkSkillInst = m_playerStatus.aSkill[i];
// Skip empty skill slots
if (0 == rkSkillInst.dwIndex)
continue;
CPythonSkill::TSkillData * pSkillData;
if (!CPythonSkill::Instance().GetSkillData(rkSkillInst.dwIndex, &pSkillData))
continue;
// Only deactivate toggle skills that are currently active
if (!pSkillData->IsToggleSkill())
continue;
if (!rkSkillInst.bActive)
continue;
__DeactivateSkillSlot(i);
}
// MR-12: -- END OF -- Deactivate all active toggle skills when affects are cleared (e.g., on death)
} }
void CPythonPlayer::SetAffect(UINT uAffect) void CPythonPlayer::SetAffect(UINT uAffect)