forked from metin-server/m2dev-client-src
@@ -16,10 +16,7 @@ This repository contains the source code necessary to compile the game client ex
|
||||
|
||||
## 📋 Changelog
|
||||
### 🐛 Bug fixes
|
||||
- **TempTrace**: Added `n` support for Python
|
||||
- **Togglable slots**: Fixed slots not deactivating on death
|
||||
- **Affects**: Added affect shower support for Mall Attack Speed
|
||||
- **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.
|
||||
- **Fog update**: Adjusted fog settings to work with the updated official version using the 3 classic options.
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
@@ -241,7 +241,9 @@ void CStateManager::SetDefaultState()
|
||||
SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
||||
SetRenderState(D3DRS_FOGENABLE, FALSE);
|
||||
SetRenderState(D3DRS_FOGCOLOR, 0xFF000000);
|
||||
SetRenderState(D3DRS_FOGTABLEMODE, D3DFOG_LINEAR);
|
||||
// MR-14: Fog update by Alaric
|
||||
SetRenderState(D3DRS_FOGTABLEMODE, D3DFOG_NONE);
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
SetRenderState(D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR);
|
||||
SetRenderState(D3DRS_RANGEFOGENABLE, FALSE);
|
||||
SetRenderState(D3DRS_ZENABLE, TRUE);
|
||||
|
||||
@@ -7,6 +7,19 @@
|
||||
|
||||
#include "PropertyLoader.h"
|
||||
|
||||
// MR-14: Fog update by Alaric
|
||||
// Not the proper way to handle this but I'm lazy
|
||||
#ifdef _DEBUG
|
||||
#undef _DEBUG
|
||||
#include <python/python.h>
|
||||
#define _DEBUG
|
||||
#else
|
||||
#include <python/python.h>
|
||||
#endif
|
||||
|
||||
#include "UserInterface/PythonSystem.h"
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// 기본 함수
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -251,12 +264,30 @@ void CMapManager::BeginEnvironment()
|
||||
DWORD dwFogColor = mc_pcurEnvironmentData->FogColor;
|
||||
STATEMANAGER.SetRenderState(D3DRS_FOGCOLOR, dwFogColor);
|
||||
|
||||
if (mc_pcurEnvironmentData->bDensityFog)
|
||||
// MR-14: Fog update by Alaric
|
||||
|
||||
// DIFFERENCE WITH THE OFFICIAL VERSION:
|
||||
/*
|
||||
Currently the official does not use the buttons "Dense", "Middle", "Light" for fog density. Instead,
|
||||
they use an On/Off boolean variable. To maintain the classic feel in the settings, we customized the
|
||||
modern official functionality into the 3-way button controls.
|
||||
|
||||
To migrate to boolean (official-like), replace mc_pcurEnvironmentData->bDensityFog with m_isFogModeEnabled
|
||||
and remove the const float fFogDensityLevel[3] and instead, multiple mc_pcurEnvironmentData->bFogLevel with
|
||||
the official 0.000010f value for the fDensity.
|
||||
|
||||
To migrate with the official, other variables in this update must be adjusted as well.
|
||||
*/
|
||||
|
||||
if (mc_pcurEnvironmentData->bDensityFog && mc_pcurEnvironmentData->bFogLevel != 0)
|
||||
{
|
||||
float fDensity = 0.00015f;
|
||||
const float fFogDensityLevel[3] = { 0.000020f, 0.000010f, 0.000005f };
|
||||
float fDensity = mc_pcurEnvironmentData->bFogLevel * fFogDensityLevel[CPythonSystem::Instance().GetFogLevel()];
|
||||
|
||||
STATEMANAGER.SetRenderState(D3DRS_FOGVERTEXMODE, D3DFOG_EXP); // pixel fog
|
||||
STATEMANAGER.SetRenderState(D3DRS_FOGDENSITY, *((DWORD *) &fDensity)); // vertex fog
|
||||
}
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
else
|
||||
{
|
||||
CSpeedTreeForestDirectX8& rkForest=CSpeedTreeForestDirectX8::Instance();
|
||||
@@ -267,6 +298,7 @@ void CMapManager::BeginEnvironment()
|
||||
|
||||
float fFogNear=mc_pcurEnvironmentData->GetFogNearDistance();
|
||||
float fFogFar=mc_pcurEnvironmentData->GetFogFarDistance();
|
||||
|
||||
STATEMANAGER.SetRenderState(D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); // vertex fox
|
||||
STATEMANAGER.SetRenderState(D3DRS_RANGEFOGENABLE, TRUE); // vertex fox
|
||||
STATEMANAGER.SetRenderState(D3DRS_FOGSTART, *((DWORD *) &fFogNear)); // USED BY D3DFOG_LINEAR
|
||||
|
||||
@@ -89,13 +89,17 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
|
||||
|
||||
SelectIndexBuffer(0, &wPrimitiveCount, &ePrimitiveType);
|
||||
|
||||
DWORD dwFogEnable = STATEMANAGER.GetRenderState(D3DRS_FOGENABLE);
|
||||
// MR-14: Fog update by Alaric
|
||||
// DWORD dwFogEnable = STATEMANAGER.GetRenderState(D3DRS_FOGENABLE);
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
std::vector<std::pair<float, long> >::iterator it = m_PatchVector.begin();
|
||||
|
||||
// NOTE: 맵툴에서는 view ~ fog near 사이의 지형을 fog disabled 상태로 그리는 작업을 하지 않음.
|
||||
STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, FALSE);
|
||||
// MR-14: Fog update by Alaric
|
||||
// STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, FALSE);
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
|
||||
for( ; it != near_it; ++it)
|
||||
for(; it != near_it; ++it)
|
||||
{
|
||||
if (byCUrrentLODLevel == 0 && fLODLevel1Distance <= it->first)
|
||||
{
|
||||
@@ -109,6 +113,7 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
|
||||
}
|
||||
|
||||
__HardwareTransformPatch_RenderPatchSplat(it->second, wPrimitiveCount, ePrimitiveType);
|
||||
|
||||
if (m_iRenderedSplatNum >= m_iSplatLimit)
|
||||
break;
|
||||
|
||||
@@ -116,7 +121,9 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
|
||||
DrawWireFrame(it->second, wPrimitiveCount, ePrimitiveType);
|
||||
}
|
||||
|
||||
STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, dwFogEnable);
|
||||
// MR-14: Fog update by Alaric
|
||||
// STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, dwFogEnable);
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
|
||||
if (m_iRenderedSplatNum < m_iSplatLimit)
|
||||
{
|
||||
@@ -143,7 +150,9 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
|
||||
}
|
||||
}
|
||||
|
||||
STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, FALSE);
|
||||
// MR-14: Fog update by Alaric
|
||||
// STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, FALSE);
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
STATEMANAGER.SetRenderState(D3DRS_LIGHTING, FALSE);
|
||||
|
||||
STATEMANAGER.SetTexture(0, NULL);
|
||||
@@ -195,7 +204,9 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
|
||||
|
||||
STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, dwFogEnable);
|
||||
// MR-14: Fog update by Alaric
|
||||
// STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, dwFogEnable);
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
STATEMANAGER.SetRenderState(D3DRS_LIGHTING, TRUE);
|
||||
|
||||
std::sort(m_RenderedTextureNumVector.begin(),m_RenderedTextureNumVector.end());
|
||||
|
||||
@@ -143,6 +143,9 @@ typedef struct SEnvironmentData
|
||||
float GetFogFarDistance() const;
|
||||
|
||||
D3DXCOLOR FogColor;
|
||||
// MR-14: Fog update by Alaric
|
||||
BYTE bFogLevel;
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
|
||||
// Filtering
|
||||
BOOL bFilteringEnable;
|
||||
|
||||
@@ -27,8 +27,10 @@ void Environment_Init(SEnvironmentData& envData)
|
||||
envData.Material.Specular = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
envData.Material.Power = 0.0f;
|
||||
|
||||
envData.bFogEnable = FALSE;
|
||||
envData.bDensityFog = FALSE;
|
||||
// MR-14: Fog update by Alaric
|
||||
envData.bFogEnable = TRUE;
|
||||
envData.bDensityFog = TRUE;
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
envData.m_fFogNearDistance = 25600.0f * 0.5f;
|
||||
envData.m_fFogFarDistance = 25600.0f * 0.7f;
|
||||
envData.FogColor = D3DXCOLOR(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
@@ -114,10 +116,13 @@ bool Environment_Load(SEnvironmentData& envData, const char* envFileName)
|
||||
|
||||
if (textLoader.SetChildNode("fog"))
|
||||
{
|
||||
textLoader.GetTokenBoolean("enable", &envData.bFogEnable);
|
||||
textLoader.GetTokenBoolean("isdensity", &envData.bDensityFog);
|
||||
textLoader.GetTokenFloat("neardistance", &envData.m_fFogNearDistance);
|
||||
textLoader.GetTokenFloat("fardistance", &envData.m_fFogFarDistance);
|
||||
// MR-14: Fog update by Alaric
|
||||
// textLoader.GetTokenBoolean("enable", &envData.bFogEnable);
|
||||
// textLoader.GetTokenBoolean("isdensity", &envData.bDensityFog);
|
||||
// textLoader.GetTokenFloat("neardistance", &envData.m_fFogNearDistance);
|
||||
// textLoader.GetTokenFloat("fardistance", &envData.m_fFogFarDistance);
|
||||
textLoader.GetTokenByte("foglevel", &envData.bFogLevel);
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
textLoader.GetTokenColor("color", &envData.FogColor);
|
||||
textLoader.SetParentNode();
|
||||
}
|
||||
|
||||
@@ -244,6 +244,18 @@ void CPythonSystem::SetShadowLevel(unsigned int level)
|
||||
CPythonBackground::instance().RefreshShadowLevel();
|
||||
}
|
||||
|
||||
// MR-14: Fog update by Alaric
|
||||
int CPythonSystem::GetFogLevel()
|
||||
{
|
||||
return m_Config.iFogLevel;
|
||||
}
|
||||
|
||||
void CPythonSystem::SetFogLevel(unsigned int level)
|
||||
{
|
||||
m_Config.iFogLevel = MIN(level, 2);
|
||||
}
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
|
||||
int CPythonSystem::IsSaveID()
|
||||
{
|
||||
return m_Config.isSaveID;
|
||||
@@ -299,6 +311,9 @@ void CPythonSystem::SetDefaultConfig()
|
||||
m_Config.bDecompressDDS = 0;
|
||||
m_Config.bSoftwareTiling = 0;
|
||||
m_Config.iShadowLevel = 3;
|
||||
// MR-14: Fog update by Alaric
|
||||
m_Config.iFogLevel = 0;
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
m_Config.bViewChat = true;
|
||||
m_Config.bAlwaysShowName = DEFAULT_VALUE_ALWAYS_SHOW_NAME;
|
||||
m_Config.bShowDamage = true;
|
||||
@@ -431,6 +446,10 @@ bool CPythonSystem::LoadConfig()
|
||||
m_Config.bSoftwareTiling = atoi(value);
|
||||
else if (!stricmp(command, "SHADOW_LEVEL"))
|
||||
m_Config.iShadowLevel = atoi(value);
|
||||
// MR-14: Fog update by Alaric
|
||||
else if (!stricmp(command, "FOG_LEVEL"))
|
||||
m_Config.iFogLevel = atoi(value);
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
else if (!stricmp(command, "DECOMPRESSED_TEXTURE"))
|
||||
m_Config.bDecompressDDS = atoi(value) == 1 ? true : false;
|
||||
else if (!stricmp(command, "NO_SOUND_CARD"))
|
||||
@@ -520,11 +539,11 @@ bool CPythonSystem::SaveConfig()
|
||||
m_Config.bDecompressDDS);
|
||||
|
||||
if (m_Config.bWindowed == 1)
|
||||
fprintf(fp, "WINDOWED %d\n", m_Config.bWindowed);
|
||||
fprintf(fp, "WINDOWED %d\n", m_Config.bWindowed);
|
||||
if (m_Config.bViewChat == 0)
|
||||
fprintf(fp, "VIEW_CHAT %d\n", m_Config.bViewChat);
|
||||
fprintf(fp, "VIEW_CHAT %d\n", m_Config.bViewChat);
|
||||
if (m_Config.bAlwaysShowName != DEFAULT_VALUE_ALWAYS_SHOW_NAME)
|
||||
fprintf(fp, "ALWAYS_VIEW_NAME %d\n", m_Config.bAlwaysShowName);
|
||||
fprintf(fp, "ALWAYS_VIEW_NAME %d\n", m_Config.bAlwaysShowName);
|
||||
if (m_Config.bShowDamage == 0)
|
||||
fprintf(fp, "SHOW_DAMAGE %d\n", m_Config.bShowDamage);
|
||||
if (m_Config.bShowSalesText == 0)
|
||||
@@ -533,6 +552,9 @@ bool CPythonSystem::SaveConfig()
|
||||
fprintf(fp, "USE_DEFAULT_IME %d\n", m_Config.bUseDefaultIME);
|
||||
fprintf(fp, "SOFTWARE_TILING %d\n", m_Config.bSoftwareTiling);
|
||||
fprintf(fp, "SHADOW_LEVEL %d\n", m_Config.iShadowLevel);
|
||||
// MR-14: Fog update by Alaric
|
||||
fprintf(fp, "FOG_LEVEL %d\n", m_Config.iFogLevel);
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
fprintf(fp, "\n");
|
||||
|
||||
fclose(fp);
|
||||
|
||||
@@ -57,6 +57,9 @@ class CPythonSystem : public CSingleton<CPythonSystem>
|
||||
bool is_object_culling;
|
||||
int iDistance;
|
||||
int iShadowLevel;
|
||||
// MR-14: Fog update by Alaric
|
||||
int iFogLevel;
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
|
||||
FLOAT music_volume;
|
||||
FLOAT voice_volume;
|
||||
@@ -149,6 +152,11 @@ class CPythonSystem : public CSingleton<CPythonSystem>
|
||||
int GetShadowLevel();
|
||||
void SetShadowLevel(unsigned int level);
|
||||
|
||||
// MR-14: Fog update by Alaric
|
||||
int GetFogLevel();
|
||||
void SetFogLevel(unsigned int level);
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
|
||||
protected:
|
||||
TResolution m_ResolutionList[RESOLUTION_MAX_NUM];
|
||||
int m_ResolutionCount;
|
||||
|
||||
@@ -372,10 +372,32 @@ PyObject * systemSetShadowLevel(PyObject * poSelf, PyObject * poArgs)
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
// MR-14: Fog update by Alaric
|
||||
PyObject * systemGetFogLevel(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
return Py_BuildValue("i", CPythonSystem::Instance().GetFogLevel());
|
||||
}
|
||||
|
||||
PyObject * systemSetFogLevel(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int iLevel;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iLevel))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonSystem::Instance().SetFogLevel(iLevel);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
|
||||
void initsystem()
|
||||
{
|
||||
static PyMethodDef s_methods[] =
|
||||
{
|
||||
// MR-14: Fog update by Alaric
|
||||
{ "GetFogLevel", systemGetFogLevel, METH_VARARGS },
|
||||
{ "SetFogLevel", systemSetFogLevel, METH_VARARGS },
|
||||
// MR-14: -- END OF -- Fog update by Alaric
|
||||
|
||||
{ "GetWidth", systemGetWidth, METH_VARARGS },
|
||||
{ "GetHeight", systemGetHeight, METH_VARARGS },
|
||||
|
||||
|
||||
Reference in New Issue
Block a user