Keep the camera looking to the same kart when changing view type (#3205)

Except for first-person view which keeps resetting to the player kart (the FP view itself is linked to it)
This commit is contained in:
Alayan-stk-2 2018-04-18 00:49:43 +02:00 committed by auriamg
parent c23f1bbc5b
commit 539ab45b08

View File

@ -550,21 +550,25 @@ bool handleContextMenuAction(s32 cmd_id)
case DEBUG_GUI_CAM_TOP:
CameraDebug::setDebugType(CameraDebug::CM_DEBUG_TOP_OF_KART);
Camera::changeCamera(0, Camera::CM_TYPE_DEBUG);
Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
irr_driver->getDevice()->getCursorControl()->setVisible(true);
break;
case DEBUG_GUI_CAM_WHEEL:
CameraDebug::setDebugType(CameraDebug::CM_DEBUG_GROUND);
Camera::changeCamera(0, Camera::CM_TYPE_DEBUG);
Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
irr_driver->getDevice()->getCursorControl()->setVisible(true);
break;
case DEBUG_GUI_CAM_BEHIND_KART:
CameraDebug::setDebugType(CameraDebug::CM_DEBUG_BEHIND_KART);
Camera::changeCamera(0, Camera::CM_TYPE_DEBUG);
Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
irr_driver->getDevice()->getCursorControl()->setVisible(true);
break;
case DEBUG_GUI_CAM_SIDE_OF_KART:
CameraDebug::setDebugType(CameraDebug::CM_DEBUG_SIDE_OF_KART);
Camera::changeCamera(0, Camera::CM_TYPE_DEBUG);
Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
irr_driver->getDevice()->getCursorControl()->setVisible(true);
break;
case DEBUG_GUI_CAM_FREE:
@ -585,6 +589,7 @@ bool handleContextMenuAction(s32 cmd_id)
{
Camera *camera = Camera::getActiveCamera();
Camera::changeCamera(camera->getIndex(), Camera::CM_TYPE_NORMAL);
Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
irr_driver->getDevice()->getCursorControl()->setVisible(true);
break;
}