Fixed memory leak, adjusted camera angle for split screen (which

showed the kart in the middle of the screen, not in the lower).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2963 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2009-01-18 23:38:24 +00:00
parent c00e3c72e0
commit d68ac2b8ac

View File

@ -53,6 +53,7 @@ Camera::Camera(int camera_index, const Kart* kart)
Camera::~Camera()
{
reset();
if(m_context) delete m_context;
}
// ----------------------------------------------------------------------------
@ -196,9 +197,15 @@ void Camera::update (float dt)
// Set the camera rotation
// -----------------------
float sign = reverse ? 1.0f : -1.0f;
btQuaternion cam_rot(0.0f,
m_mode==CM_CLOSEUP ? (sign * 25.0f * M_PI / 180.0f) : (sign * 15.0f * M_PI / 180.0f), // it was +-15 or +-5 degrees, giving too much unnecesary sky and few track around kart
reverse ? M_PI : 0.0f);
const int num_players = race_manager->getNumLocalPlayers();
float pitch;
if(m_mode!=CM_CLOSEUP)
pitch = race_manager->getNumLocalPlayers()>1 ? sign * DEGREE_TO_RAD(10.0f)
: sign * DEGREE_TO_RAD(15.0f);
else
pitch = sign * DEGREE_TO_RAD(25.0f);
btQuaternion cam_rot(0.0f, pitch, reverse ? M_PI : 0.0f);
// Camera position relative to the kart
btTransform relative_to_kart(cam_rot, cam_rel_pos);