void CCameraHandler::SetCameraMode(unsigned int mode) { if ((mode >= camControllers.size()) || (mode == static_cast<unsigned int>(currCamCtrlNum))) { return; } CameraTransition(1.0f); CCameraController* oldCamCtrl = currCamCtrl; currCamCtrlNum = mode; currCamCtrl = camControllers[mode]; currCamCtrl->SetPos(oldCamCtrl->SwitchFrom()); currCamCtrl->SwitchTo(); }
void CCameraHandler::SetCameraMode(unsigned int newMode) { if ((newMode >= camControllers.size()) || (newMode == currCamCtrlNum)) return; CameraTransition(1.0f); const unsigned int oldMode = currCamCtrlNum; CCameraController* oldCamCtrl = camControllers[currCamCtrlNum ]; CCameraController* newCamCtrl = camControllers[currCamCtrlNum = newMode]; newCamCtrl->SetPos(oldCamCtrl->SwitchFrom()); newCamCtrl->SwitchTo(oldMode); newCamCtrl->Update(); }
void CMouseHandler::SetCameraMode(int mode) { if ((mode < 0) || (mode >= camControllers.size()) || (mode == currentCamControllerNum) || (!camControllers[currentCamControllerNum]->enabled)) { return; } currentCamControllerNum = mode; CameraTransition(1.0f); CCameraController* oldc = currentCamController; currentCamController = camControllers[currentCamControllerNum]; currentCamController->SetPos(oldc->SwitchFrom()); currentCamController->SwitchTo(); }
void CCameraHandler::ToggleState() { CameraTransition(1.0f); CCameraController* oldCamCtrl = currCamCtrl; currCamCtrlNum++; if (currCamCtrlNum >= camControllers.size()) { currCamCtrlNum = 0; } int a = 0; const int maxTries = camControllers.size() - 1; while ((a < maxTries) && !camControllers[currCamCtrlNum]->enabled) { currCamCtrlNum++; if (currCamCtrlNum >= camControllers.size()) { currCamCtrlNum = 0; } a++; } currCamCtrl = camControllers[currCamCtrlNum]; currCamCtrl->SetPos(oldCamCtrl->SwitchFrom()); currCamCtrl->SwitchTo(); }