feat: Make camera toggle and game speed controls exclusive to devmode
This commit is contained in:
parent
383905b790
commit
17d24de3cf
4 changed files with 19 additions and 11 deletions
|
@ -40,10 +40,13 @@ Controls:
|
|||
- Left click to interact with an object
|
||||
- Right click and move the mouse to rotate the camera
|
||||
- Press Space to pause the game
|
||||
- Press V to switch the camera type
|
||||
- Use "-" and "+" keys to adjust the game speed
|
||||
- Press "~" to toggle the debug console
|
||||
|
||||
Developer mode controls:
|
||||
|
||||
- Press V to switch the camera type
|
||||
- Use "+" and "-" keys to adjust the game speed
|
||||
|
||||
## Configuration
|
||||
|
||||
reone can be configured from either a command line or a configuration file. Configuration file, named "reone.cfg", must be located in the current directory. See a complete list of options [here](https://github.com/seedhartha/reone/wiki/Program-options).
|
||||
|
|
|
@ -305,8 +305,8 @@ void Game::toggleInGameCameraType() {
|
|||
case CameraType::ThirdPerson: {
|
||||
_module->player().stopMovement();
|
||||
shared_ptr<Area> area(_module->area());
|
||||
auto &thirdPerson = static_cast<ThirdPersonCamera &>(area->getCamera(CameraType::ThirdPerson));
|
||||
auto &firstPerson = static_cast<FirstPersonCamera &>(area->getCamera(CameraType::FirstPerson));
|
||||
auto &thirdPerson = area->getCamera<ThirdPersonCamera>(CameraType::ThirdPerson);
|
||||
auto &firstPerson = area->getCamera<FirstPersonCamera>(CameraType::FirstPerson);
|
||||
firstPerson.setPosition(thirdPerson.sceneNode()->absoluteTransform()[3]);
|
||||
firstPerson.setFacing(thirdPerson.facing());
|
||||
_cameraType = CameraType::FirstPerson;
|
||||
|
@ -776,19 +776,19 @@ bool Game::handleKeyDown(const SDL_KeyboardEvent &event) {
|
|||
|
||||
switch (event.keysym.sym) {
|
||||
case SDLK_MINUS:
|
||||
if (_gameSpeed > 1.0f) {
|
||||
if (_options.developer && _gameSpeed > 1.0f) {
|
||||
_gameSpeed = glm::max(1.0f, _gameSpeed - 1.0f);
|
||||
}
|
||||
return true;
|
||||
|
||||
case SDLK_EQUALS:
|
||||
if (_gameSpeed < 8.0f) {
|
||||
if (_options.developer && _gameSpeed < 8.0f) {
|
||||
_gameSpeed = glm::min(8.0f, _gameSpeed + 1.0f);
|
||||
}
|
||||
return true;
|
||||
|
||||
case SDLK_v:
|
||||
if (_screen == GameScreen::InGame) {
|
||||
if (_options.developer && _screen == GameScreen::InGame) {
|
||||
toggleInGameCameraType();
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -152,7 +152,7 @@ void DialogGUI::onStart() {
|
|||
_currentSpeaker = _owner;
|
||||
loadStuntParticipants();
|
||||
|
||||
auto &camera = static_cast<AnimatedCamera &>(_game->module()->area()->getCamera(CameraType::Animated));
|
||||
auto &camera = _game->module()->area()->getCamera<AnimatedCamera>(CameraType::Animated);
|
||||
camera.setModel(_cameraModel);
|
||||
}
|
||||
|
||||
|
@ -237,12 +237,12 @@ void DialogGUI::updateCamera() {
|
|||
shared_ptr<Creature> player(_game->party().player());
|
||||
glm::vec3 listenerPosition(player ? getTalkPosition(*player) : glm::vec3(0.0f));
|
||||
glm::vec3 speakerPosition(_currentSpeaker ? getTalkPosition(*_currentSpeaker) : glm::vec3(0.0f));
|
||||
auto &camera = static_cast<DialogCamera &>(area->getCamera(CameraType::Dialog));
|
||||
auto &camera = area->getCamera<DialogCamera>(CameraType::Dialog);
|
||||
camera.setListenerPosition(listenerPosition);
|
||||
camera.setSpeakerPosition(speakerPosition);
|
||||
camera.setVariant(getRandomCameraVariant());
|
||||
} else {
|
||||
auto &camera = static_cast<AnimatedCamera &>(area->getCamera(CameraType::Animated));
|
||||
auto &camera = area->getCamera<AnimatedCamera>(CameraType::Animated);
|
||||
camera.setFieldOfView(_currentEntry->camFieldOfView != 0.0f ? _currentEntry->camFieldOfView : kDefaultAnimCamFOV);
|
||||
camera.playAnimation(_currentEntry->cameraAnimation);
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ void DialogGUI::update(float dt) {
|
|||
|
||||
// Dialog camera follows the current speaker, if any
|
||||
if (_currentSpeaker && _game->cameraType() == CameraType::Dialog) {
|
||||
auto &camera = static_cast<DialogCamera &>(_game->module()->area()->getCamera(CameraType::Dialog));
|
||||
auto &camera = _game->module()->area()->getCamera<DialogCamera>(CameraType::Dialog);
|
||||
camera.setSpeakerPosition(getTalkPosition(*_currentSpeaker));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,6 +126,11 @@ public:
|
|||
void setStaticCamera(int cameraId);
|
||||
void setThirdPartyCameraStyle(CameraStyleType type);
|
||||
|
||||
template <class T>
|
||||
T &getCamera(CameraType type) {
|
||||
return static_cast<T &>(getCamera(type));
|
||||
};
|
||||
|
||||
// END Cameras
|
||||
|
||||
// Party
|
||||
|
|
Loading…
Reference in a new issue