Jump to content

Field of View - System Option


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Hey folks,

 

i was asked if it's possible to change the Field of View ingame through option and i wanted to share with you. 

This is what this Release looks like:

spacer.png

Locale_inc.h

Spoiler








#define ENABLE_FOV_OPTION

 

 

PythonApplication.cpp

Spoiler

search for:









m_pyGraphic.SetPerspective(30.0f, fAspect, 100.0, fFarClip);

change it like this:









#ifdef ENABLE_FOV_OPTION
        float fFOV = m_pySystem.GetFOVLevel();
        m_pyGraphic.SetPerspective(fFOV, fAspect, 100.0, fFarClip);
#else
        m_pyGraphic.SetPerspective(30.0f, fAspect, 100.0, fFarClip);
#endif

 

PythonApplicationModule.cpp

Spoiler

before:









#ifdef USE_OPENID
    PyModule_AddIntConstant(poModule, "USE_OPENID",    1);
    if (openid_test)
        PyModule_AddIntConstant(poModule, "OPENID_TEST",    1);
    else
        PyModule_AddIntConstant(poModule, "OPENID_TEST",    0);
#else
    PyModule_AddIntConstant(poModule, "USE_OPENID",    0);
    PyModule_AddIntConstant(poModule, "OPENID_TEST",    0);
#endif /* USE_OPENID */

add:









#ifdef ENABLE_FOV_OPTION
    PyModule_AddIntConstant(poModule, "ENABLE_FOV_OPTION", 1);
#else
    PyModule_AddIntConstant(poModule, "ENABLE_FOV_OPTION", 0);
#endif

 

PythonSystem.cpp

Spoiler

search for:









void CPythonSystem::SetSoundVolumef(float fVolume)
{
    m_Config.voice_volume = int(5 * fVolume);
}

add after:





#ifdef ENABLE_FOV_OPTION
void CPythonSystem::SetFOVLevel(float fFOV)
{
	m_Config.iFOVLevel = fMINMAX(30.0f, fFOV, 120.0f);
}

float CPythonSystem::GetFOVLevel()
{
	return m_Config.iFOVLevel;
}
#endif

search for:









void CPythonSystem::SetDefaultConfig()
{
    memset(&m_Config, 0, sizeof(m_Config));
    m_Config.width                = 1024;
    m_Config.height                = 768;
    m_Config.bpp                = 32;
#if defined( LOCALE_SERVICE_WE_JAPAN )
    m_Config.bWindowed            = true;
#else
    m_Config.bWindowed            = false;
#endif
    m_Config.is_software_cursor    = false;
    m_Config.is_object_culling    = true;
    m_Config.iDistance            = 3;
    m_Config.gamma                = 3;
    m_Config.music_volume        = 1.0f;
    m_Config.voice_volume        = 5;
    m_Config.bDecompressDDS        = 0;
    m_Config.bSoftwareTiling    = 0;
    m_Config.iShadowLevel        = 3;

add after:









#ifdef ENABLE_FOV_OPTION
    m_Config.iFOVLevel            = 30.0f;
#endif

search for:









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

add after:









#ifdef ENABLE_FOV_OPTION
        else if (!stricmp(command, "FIELD_OF_VIEW"))
            m_Config.iFOVLevel = atoi(value);
#endif

search for:









    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);

add after:









#ifdef ENABLE_FOV_OPTION
    fprintf(fp, "FIELD_OF_VIEW            %.1f\n", m_Config.iFOVLevel);
#endif

 

PythonSystem.h

Spoiler

search for:









        typedef struct SConfig
        {
            DWORD            width;
            DWORD            height;
            DWORD            bpp;
            DWORD            frequency;
            bool            is_software_cursor;
            bool            is_object_culling;
            int                iDistance;
            int                iShadowLevel;

add after:









#ifdef ENABLE_FOV_OPTION
            FLOAT            iFOVLevel;
#endif

search for:









        int                                GetDistance();
        int                                GetShadowLevel();
        void                            SetShadowLevel(unsigned int level);

add after:









#ifdef ENABLE_FOV_OPTION
        float                            GetFOVLevel();
        void                            SetFOVLevel(float fFOV);
#endif

 

 PythonSystemModule.cpp

Spoiler

search for:









PyObject * systemSetMusicVolume(PyObject * poSelf, PyObject * poArgs)
{
    float fVolume;
    if (!PyTuple_GetFloat(poArgs, 0, &fVolume))
        return Py_BuildException();
    CPythonSystem::Instance().SetMusicVolume(fVolume);
    return Py_BuildNone();
}

add after:









#ifdef ENABLE_FOV_OPTION
PyObject * systemSetFOVLevel(PyObject * poSelf, PyObject * poArgs)
{
    float fFOV;
    if (!PyTuple_GetFloat(poArgs, 0, &fFOV))
        return Py_BuildException();
    CPythonSystem::Instance().SetFOVLevel(fFOV);
    return Py_BuildNone();
}
PyObject * systemGetFOVLevel(PyObject * poSelf, PyObject * poArgs)
{
    return Py_BuildValue("f", CPythonSystem::Instance().GetFOVLevel());
}
#endif

search for:









        { "GetShadowLevel",                systemGetShadowLevel,            METH_VARARGS },
        { "SetShadowLevel",                systemSetShadowLevel,            METH_VARARGS },

add after:









#ifdef ENABLE_FOV_OPTION
        { "GetFOVLevel",                systemGetFOVLevel,                METH_VARARGS },
        { "SetFOVLevel",                systemSetFOVLevel,                METH_VARARGS },
#endif

 


uisystemoption.py

Spoiler

search for:









        self.tilingModeButtonList = []
        # self.ctrlShadowQuality = 0

add after:









        if app.ENABLE_FOV_OPTION:
            self.changeFOV = 0

search:









            self.tilingModeButtonList.append(GetObject("tiling_cpu"))
            self.tilingModeButtonList.append(GetObject("tiling_gpu"))
            self.tilingApplyButton=GetObject("tiling_apply")

add:









            if app.ENABLE_FOV_OPTION:
                self.changeFOV = GetObject("fov_bar")

search:









        self.ctrlMusicVolume.SetSliderPos(float(systemSetting.GetMusicVolume()))
        self.ctrlMusicVolume.SetEvent(ui.__mem_func__(self.OnChangeMusicVolume))
        self.ctrlSoundVolume.SetSliderPos(float(systemSetting.GetSoundVolume()) / 5.0)
        self.ctrlSoundVolume.SetEvent(ui.__mem_func__(self.OnChangeSoundVolume))

add:









        if app.ENABLE_FOV_OPTION:
            self.changeFOV.SetSliderPos(float(systemSetting.GetFOVLevel()) / 5.0)
            self.changeFOV.SetEvent(ui.__mem_func__(self.OnChangeFOV))

search:









    def OnChangeSoundVolume(self):
        pos = self.ctrlSoundVolume.GetSliderPos()
        snd.SetSoundVolumef(pos)
        systemSetting.SetSoundVolumef(pos)

add:




	if app.ENABLE_FOV_OPTION:
		def OnChangeFOV(self):
			pos = self.changeFOV.GetSliderPos()
			systemSetting.SetFOVLevel(int(pos / 0.008))

 

uiscript/systemoptiondialog.py

Spoiler








                {
                    "name" : "fov_mode",
                    "type" : "text",
                    "x" : 30,
                    "y" : 210,
                    "text" : uiScriptLocale.OPTION_FOV,
                },
                
                {
                    "name" : "fov_bar",
                    "type" : "sliderbar",
                    "x" : 110,
                    "y" : 210,
                },

 

locale_xx/xx/locale_interface.txt

Spoiler

 

OPTION_FOV Field of View

 

 

 

252730RedInfo.pngUPDATE SHOP_SIGN:

  PythonApplication.cpp

Spoiler

search in void CPythonApplication::RenderGame() :



	m_pyGraphic.SetPerspective(30.0f, fAspect, 100.0, fFarClip);

replace with:



#ifdef ENABLE_FOV_OPTION
	float fFOV = m_pySystem.GetFOVLevel();
	m_pyGraphic.SetPerspective(fFOV, fAspect, 100.0, fFarClip);
#else
	m_pyGraphic.SetPerspective(30.0f, fAspect, 100.0, fFarClip);
#endif

search:



s.SetPerspective(30.0f,fAspect, 100.0f, fFarClip);

replace with:



#ifdef ENABLE_FOV_OPTION
		float fFOV = CPythonSystem::Instance().GetFOVLevel();
		s.SetPerspective(fFOV, fAspect, 100.0f, fFarClip);
#else
		s.SetPerspective(30.0f,fAspect, 100.0f, fFarClip);
#endif

 

 

Kind Regards,

 

.Dex

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 64
  • Dislove 1
  • Cry 1
  • Think 3
  • Good 14
  • Love 4
  • Love 54

spacer.png

Link to comment
Share on other sites

12 hours ago, Rusef said:

I implemented the system, but i've come across a small bug:

https://metin2.download/picture/7fe60CcxRzbkgSG7J2ZZcFuP6t3uD26r/.gif

 

i would be glad if you can help me

 

Well, clearly you have to modify your items coords and window height in the systemoptiondialog.py :)

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 2
Link to comment
Share on other sites

1 hour ago, Silencio said:

Well, clearly you have to modify your items coords and window height in the systemoptiondialog.py :)

 

Lol, he's talking about the offlineshop name.

Anyway i have the same bug too and now i handling to fix these as soon as possible and share the fix.

Edited by MentaLL
  • Love 1

mindset

Link to comment
Share on other sites

@Rusef@MentaLL

 

Fix for the shop name should be in PythonApplication.cpp

 

This line is there twice.

m_pyGraphic.SetPerspective(30.0f, fAspect, 100.0, fFarClip);

 

You need to replace in

void CPythonApplication::RenderGame()

 

and also in

void CPythonApplication::UpdateGame()

Edited by lastone122
  • Good 1
  • Love 4
Link to comment
Share on other sites

1 hour ago, lastone122 said:

@Rusef@MentaLL

 

Fix for the shop name should be in PythonApplication.cpp

 

This line is there twice.

m_pyGraphic.SetPerspective(30.0f, fAspect, 100.0, fFarClip);

 

You need to replace in

void CPythonApplication::RenderGame()

 

and also in

void CPythonApplication::UpdateGame()

 

Not working.

mindset

Link to comment
Share on other sites

  • 1 year later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.