Applied Graham's 'reverse camera' patch, which changes to reverse camera when driving

backwards faster than a certain speed (defined in user config).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4399 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-01-05 01:13:53 +00:00
parent f463c00dc7
commit d39b76f433
2 changed files with 13 additions and 2 deletions

View File

@ -250,6 +250,9 @@ namespace UserConfigParams
PARAM_PREFIX BoolUserConfigParam m_log_errors
PARAM_DEFAULT( BoolUserConfigParam(false, "log_errors", "Enable logging of stdout and stderr to logfile") );
PARAM_PREFIX IntUserConfigParam m_reverse_look_threshold
PARAM_DEFAULT( IntUserConfigParam(9, "reverse_look_threshold") );
PARAM_PREFIX StringUserConfigParam m_item_style
PARAM_DEFAULT( StringUserConfigParam("items", "item_style", "Name of the .items file to use.") );

View File

@ -278,9 +278,17 @@ void PlayerKart::update(float dt)
if (m_powerup.getType()==POWERUP_NOTHING)
Kart::beep();
}
// Camera looks back when reversing
if(m_camera->getMode()!=Camera::CM_FINAL)
m_camera->setMode(m_controls.m_look_back ? Camera::CM_REVERSE
: Camera::CM_NORMAL);
{
// look backward when the player requests or
// if automatic reverse camera is active
if (m_controls.m_look_back || (UserConfigParams::m_reverse_look_threshold>0 && Kart::getSpeed()<-UserConfigParams::m_reverse_look_threshold))
m_camera->setMode(Camera::CM_REVERSE);
else
m_camera->setMode(Camera::CM_NORMAL);
}
// We can't restrict rescue to fulfil isOnGround() (which would be more like
// MK), since e.g. in the City track it is possible for the kart to end