Made field-of-view configurable in the config file.

This commit is contained in:
hiker 2015-07-22 08:12:44 +10:00
parent bb058deea5
commit 2f51406e3d
4 changed files with 19 additions and 3 deletions

View File

@ -133,6 +133,11 @@
work anymore - so for now don't enable this. --> work anymore - so for now don't enable this. -->
<networking enable="false"/> <networking enable="false"/>
<!-- The field od views for 1-4 player split screen. fov-3 is
actually not used (since 3 player split screen uses the
same layout as 4 player split screen) -->
<camera fov-1="75" fov-2="65" fov-3="50" fov-4="75" />
<!-- disable-while-unskid: Disable steering when stop skidding during <!-- disable-while-unskid: Disable steering when stop skidding during
the time it takes to adjust the physical body with the graphics. the time it takes to adjust the physical body with the graphics.
camera-follow-skid: If true the camera will stay behind the kart, camera-follow-skid: If true the camera will stay behind the kart,

View File

@ -275,6 +275,14 @@ void STKConfig::getAllData(const XMLNode * root)
steer_node->get("camera-follow-skid", &m_camera_follow_skid ); steer_node->get("camera-follow-skid", &m_camera_follow_skid );
} }
if (const XMLNode *camera = root->getNode("camera"))
{
camera->get("fov-1", &m_camera_fov[0]);
camera->get("fov-2", &m_camera_fov[1]);
camera->get("fov-3", &m_camera_fov[2]);
camera->get("fov-4", &m_camera_fov[3]);
}
if (const XMLNode *music_node = root->getNode("music")) if (const XMLNode *music_node = root->getNode("music"))
{ {
std::string title_music; std::string title_music;

View File

@ -157,6 +157,9 @@ public:
* be generated. */ * be generated. */
float m_replay_delta_angle; float m_replay_delta_angle;
/** The field of view for 1, 2, 3, 4 player split screen. */
float m_camera_fov[4];
private: private:
/** True if stk_config has been loaded. This is necessary if the /** True if stk_config has been loaded. This is necessary if the
* --stk-config command line parameter has been specified to avoid * --stk-config command line parameter has been specified to avoid

View File

@ -222,7 +222,7 @@ void Camera::setupCamera()
irr_driver->getActualScreenSize().Width, irr_driver->getActualScreenSize().Width,
irr_driver->getActualScreenSize().Height); irr_driver->getActualScreenSize().Height);
m_scaling = core::vector2df(1.0f, 1.0f); m_scaling = core::vector2df(1.0f, 1.0f);
m_fov = DEGREE_TO_RAD*75.0f; m_fov = DEGREE_TO_RAD*stk_config->m_camera_fov[0];
break; break;
case 2: m_viewport = core::recti(0, case 2: m_viewport = core::recti(0,
m_index==0 ? 0 m_index==0 ? 0
@ -232,7 +232,7 @@ void Camera::setupCamera()
: irr_driver->getActualScreenSize().Height); : irr_driver->getActualScreenSize().Height);
m_scaling = core::vector2df(1.0f, 0.5f); m_scaling = core::vector2df(1.0f, 0.5f);
m_aspect *= 2.0f; m_aspect *= 2.0f;
m_fov = DEGREE_TO_RAD*65.0f; m_fov = DEGREE_TO_RAD*stk_config->m_camera_fov[1];
break; break;
case 3: case 3:
/* /*
@ -265,7 +265,7 @@ void Camera::setupCamera()
const int y2 = (m_index<2 ? irr_driver->getActualScreenSize().Height>>1 : irr_driver->getActualScreenSize().Height); const int y2 = (m_index<2 ? irr_driver->getActualScreenSize().Height>>1 : irr_driver->getActualScreenSize().Height);
m_viewport = core::recti(x1, y1, x2, y2); m_viewport = core::recti(x1, y1, x2, y2);
m_scaling = core::vector2df(0.5f, 0.5f); m_scaling = core::vector2df(0.5f, 0.5f);
m_fov = DEGREE_TO_RAD*50.0f; m_fov = DEGREE_TO_RAD*stk_config->m_camera_fov[3];
} }
break; break;
default: default: