Jump to content

Field of View - System Option


Recommended Posts

  • VIP

M2 Download Center

Download Here ( 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

  • Love 10

spacer.png

Link to post
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

www.ashens2.com

Link to post

@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
  • Love 3
Link to post
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.

www.ashens2.com

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Activity

    1. 0

      Compile Server

    2. 0

      QC error message for special characters next to apostrophes

    3. 135

      Render Target Remastered

    4. 0

      Mount not attacking

    5. 2

      Rodnia2 | PVM | International | 3k+ players | Multiple-Languages | 2nd server opening: 13.02.2021

    6. 218

      WorldEditor ReMIX

    7. 54

      Quiver System

    8. 72

      Party Flag

  • Recently Browsing

    No registered users viewing this page.

Shoutbox

Shoutbox

Chatroom Rules

 

Join our Discord

A request for help = Shoutbox Ban

Be respectful & Respect the rules

 

×
×
  • 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.