// UserInterface // Locale_inc.h açılır ve eklenir.

#define ENABLE_TEXTURE_CHANGER // Zemin değiştirme sistemi



// UserInterface // PythonBackgroundModule.cpp açılır ve aratılır.


PyObject * backgroundEnableSoftwareTiling(PyObject * poSelf, PyObject * poArgs)
{
	int nIsEnable;
	if (!PyTuple_GetInteger(poArgs, 0, &nIsEnable))
		return Py_BadArgument();

	bool isEnable=nIsEnable ? true : false;

	CPythonBackground& rkBG=CPythonBackground::Instance();
	rkBG.ReserveSoftwareTilingEnable(isEnable);

	CPythonSystem& rkSystem=CPythonSystem::Instance();
	rkSystem.SetSoftwareTiling(isEnable);
	return Py_BuildNone();
}

// Altına eklenir;

#ifdef ENABLE_TEXTURE_CHANGER
PyObject * backgroundTextureChange(PyObject * poSelf, PyObject * poArgs)
{
	char * szFileName;
	if (!PyTuple_GetString(poArgs, 0, &szFileName))
		return Py_BuildException();

	CPythonBackground& rkBG = CPythonBackground::Instance();
	CMapOutdoor& rkMap = rkBG.GetMapOutdoorRef();
	rkMap.TextureChange(szFileName);
	return Py_BuildNone();
}
#endif

// Aratılır

		{ "EnableSoftwareTiling",				backgroundEnableSoftwareTiling,				METH_VARARGS }, 

// Altına eklenir;

#ifdef ENABLE_TEXTURE_CHANGER
		{ "TextureChange",						backgroundTextureChange,					METH_VARARGS },
#endif

// UserInterface // PythonSystem.cpp açılır ve aratılır.

	m_Config.bShowSalesText		= true;

// Altına eklenir;

#ifdef ENABLE_TEXTURE_CHANGER
	m_Config.bSnowTexturesMode = false;
	m_Config.bDesertTexturesMode = false;
	m_Config.bGreenTexturesMode = false;
#endif

// Aratılır;

bool CPythonSystem::IsShowSalesText()
{
	return m_Config.bShowSalesText;
}

#ifdef ENABLE_TEXTURE_CHANGER
bool CPythonSystem::IsSnowTexturesMode()
{
	return m_Config.bSnowTexturesMode;
}

void CPythonSystem::SetSnowTexturesMode(int iFlag)
{
	m_Config.bSnowTexturesMode = iFlag == 1 ? true : false;
}

bool CPythonSystem::IsDesertTexturesMode()
{
	return m_Config.bDesertTexturesMode;
}

void CPythonSystem::SetDesertTexturesMode(int iFlag)
{
	m_Config.bDesertTexturesMode = iFlag == 1 ? true : false;
}

bool CPythonSystem::IsGreenTexturesMode()
{
	return m_Config.bGreenTexturesMode;
}

void CPythonSystem::SetGreenTexturesMode(int iFlag)
{
	m_Config.bGreenTexturesMode = iFlag == 1 ? true : false;
}
#endif


// Aratılır

		else if (!stricmp(command, "SHOW_SALESTEXT"))
			m_Config.bShowSalesText = atoi(value) == 1 ? true : false;

// Altına eklenir;

#ifdef ENABLE_TEXTURE_CHANGER
		else if (!stricmp(command, "SNOW_TEXTURES_MODE"))
			m_Config.bSnowTexturesMode = atoi(value);
		else if (!stricmp(command, "DESERT_TEXTURES_MODE"))
			m_Config.bDesertTexturesMode = atoi(value);
		else if (!stricmp(command, "GREEN_TEXTURES_MODE"))
			m_Config.bGreenTexturesMode = atoi(value);
#endif

// Aratılır

	if (m_Config.bShowSalesText == 0)
		fprintf(fp, "SHOW_SALESTEXT		%d\n", m_Config.bShowSalesText);

// Altına eklenir;

#ifdef ENABLE_TEXTURE_CHANGER
	fprintf(fp, "SNOW_TEXTURES_MODE	%d\n", m_Config.bSnowTexturesMode);
	fprintf(fp, "DESERT_TEXTURES_MODE %d\n", m_Config.bDesertTexturesMode);
	fprintf(fp, "GREEN_TEXTURES_MODE %d\n", m_Config.bGreenTexturesMode);
#endif


// UserInterface // PythonSystem.h açılır ve aratılır.

			bool			bShowSalesText;

// Altına eklenir;

#ifdef ENABLE_TEXTURE_CHANGER
			bool			bSnowTexturesMode;
			bool			bDesertTexturesMode;
			bool			bGreenTexturesMode;
#endif

// Aratılır


		void							SetShowSalesTextFlag(int iFlag);

// Altına eklenir;

#ifdef ENABLE_TEXTURE_CHANGER
		void							SetSnowTexturesMode(int iFlag);
		bool							IsSnowTexturesMode();
		void							SetDesertTexturesMode(int iFlag);
		bool							IsDesertTexturesMode();
		void							SetGreenTexturesMode(int iFlag);
		bool							IsGreenTexturesMode();
#endif


// UserInterface // PythonSystemModule.cpp açılır ve aratılır.

PyObject * systemIsShowSalesText(PyObject * poSelf, PyObject * poArgs)
{
	return Py_BuildValue("i", CPythonSystem::Instance().IsShowSalesText());
}

// Altına eklenir;

#ifdef ENABLE_TEXTURE_CHANGER
PyObject * systemIsSnowTexturesMode(PyObject * poSelf, PyObject * poArgs)
{
	return Py_BuildValue("i", CPythonSystem::Instance().IsSnowTexturesMode());
}

PyObject * systemSetSnowTexturesMode(PyObject * poSelf, PyObject * poArgs)
{
	int iFlag;
	if (!PyTuple_GetInteger(poArgs, 0, &iFlag))
		return Py_BuildException();

	CPythonSystem::Instance().SetSnowTexturesMode(iFlag);

	return Py_BuildNone();
}

PyObject * systemIsDesertTexturesMode(PyObject * poSelf, PyObject * poArgs)
{
	return Py_BuildValue("i", CPythonSystem::Instance().IsDesertTexturesMode());
}

PyObject * systemSetDesertTexturesMode(PyObject * poSelf, PyObject * poArgs)
{
	int iFlag;
	if (!PyTuple_GetInteger(poArgs, 0, &iFlag))
		return Py_BuildException();

	CPythonSystem::Instance().SetDesertTexturesMode(iFlag);

	return Py_BuildNone();
}

PyObject * systemIsGreenTexturesMode(PyObject * poSelf, PyObject * poArgs)
{
	return Py_BuildValue("i", CPythonSystem::Instance().IsGreenTexturesMode());
}

PyObject * systemSetGreenTexturesMode(PyObject * poSelf, PyObject * poArgs)
{
	int iFlag;
	if (!PyTuple_GetInteger(poArgs, 0, &iFlag))
		return Py_BuildException();

	CPythonSystem::Instance().SetGreenTexturesMode(iFlag);

	return Py_BuildNone();
}
#endif

// Aratılır

		{ "IsShowSalesText",			systemIsShowSalesText,			METH_VARARGS },

// Altına eklenir;

#ifdef ENABLE_TEXTURE_CHANGER
		{ "IsSnowTexturesMode", systemIsSnowTexturesMode, METH_VARARGS },
		{ "SetSnowTexturesMode", systemSetSnowTexturesMode, METH_VARARGS },
		{ "IsDesertTexturesMode", systemIsDesertTexturesMode, METH_VARARGS },
		{ "SetDesertTexturesMode", systemSetDesertTexturesMode, METH_VARARGS },
		{ "IsGreenTexturesMode", systemIsGreenTexturesMode, METH_VARARGS },
		{ "SetGreenTexturesMode", systemSetGreenTexturesMode, METH_VARARGS },
#endif 


// Gamelib // MapOutdoor.cpp açılır ve aratılır.

#include "../EffectLib/EffectManager.h"

// Altına eklenir;

#include "../UserInterface/Locale_inc.h"

// Aratılır

void CMapOutdoor::SetEnvironmentScreenFilter()
{
	if (!mc_pEnvironmentData)
		return;

	m_ScreenFilter.SetEnable(mc_pEnvironmentData->bFilteringEnable);
	m_ScreenFilter.SetBlendType(mc_pEnvironmentData->byFilteringAlphaSrc, mc_pEnvironmentData->byFilteringAlphaDest);
	m_ScreenFilter.SetColor(mc_pEnvironmentData->FilteringColor);
}

// Altına eklenir;

#ifdef ENABLE_TEXTURE_CHANGER
void CMapOutdoor::TextureChange(const char * c_szFileName)
{
	m_fTerrainTexCoordBase = 1.0f / (float)(CTerrainImpl::PATCH_XSIZE * CTerrainImpl::CELLSCALE);

	std::string strFileName;
	StringPath(c_szFileName, strFileName);

	std::string stTextureSetFileName = strFileName;

	// TextureSet ? ?? ?? ?? ?? ????.
	if (0 != stTextureSetFileName.find_first_of("textureset", 0))
		stTextureSetFileName = "textureset\\" + strFileName;

	if (!m_TextureSet.Load(stTextureSetFileName.c_str(), m_fTerrainTexCoordBase))
	{
#ifdef WORLD_EDITOR
		// TextureSet ? ???? ?? ??? ??
		LogBox("TextureSet ? ?????? ?? ? ???.\n?? ??? ??? ????? ????.");
#else
		TraceError("MapOutdoor::LoadSetting(c_szFileName=%s) - LOAD TEXTURE SET(%s) ERROR", c_szFileName, stTextureSetFileName.c_str());
		return;
#endif
	}

	CTerrain::SetTextureSet(&m_TextureSet);
}
#endif

// Gamelib // MapOutdoor.h açılır ve aratılır.

#include "../SpeedTreeLib/SpeedTreeForestDirectX8.h"

// Altına eklenir;

#include "../UserInterface/Locale_inc.h"

// Aratılır

		void			RenderScreenFiltering();

// Altına eklenir;

#ifdef ENABLE_TEXTURE_CHANGER
		void 			TextureChange(const char * c_szFileName);
#endif