From e6060173af9717f7d636d55bc530b05940d5778e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Meelis=20M=C3=A4gi?= Date: Wed, 5 Jul 2023 10:49:44 +0000 Subject: [PATCH] Resolve "Toggle Free Look with Hotkey" --- ryzom/client/data/gamedev/interfaces_v3/actions.xml | 1 + ryzom/client/data/gamedev/interfaces_v3/keys.xml | 1 + ryzom/client/data/gamedev/interfaces_v3/keys_r2ed.xml | 1 + ryzom/client/src/interface_v3/action_handler_game.cpp | 14 ++++++++++++++ ryzom/client/src/motion/user_controls.h | 2 ++ 5 files changed, 19 insertions(+) diff --git a/ryzom/client/data/gamedev/interfaces_v3/actions.xml b/ryzom/client/data/gamedev/interfaces_v3/actions.xml index 0a00cb0f6..194434a83 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/actions.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/actions.xml @@ -417,6 +417,7 @@ + diff --git a/ryzom/client/data/gamedev/interfaces_v3/keys.xml b/ryzom/client/data/gamedev/interfaces_v3/keys.xml index 677854a9e..60d219ddb 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/keys.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/keys.xml @@ -36,6 +36,7 @@ + diff --git a/ryzom/client/data/gamedev/interfaces_v3/keys_r2ed.xml b/ryzom/client/data/gamedev/interfaces_v3/keys_r2ed.xml index 65c7603cd..b7ecb6551 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/keys_r2ed.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/keys_r2ed.xml @@ -37,6 +37,7 @@ + diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 8c8c56e34..15851758d 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -861,6 +861,20 @@ protected: REGISTER_ACTION_HANDLER( CHandlerContextFreeLook, "context_free_look"); // *************************************************************************** +class CHandlerToggleFreeLook : public IActionHandler +{ +public: + void execute(CCtrlBase * /* pCaller */, const std::string & /* sParams */) + { + if (UserControls.getFreeLook()) + UserControls.stopFreeLook(); + else + UserControls.startFreeLook(); + } +}; +REGISTER_ACTION_HANDLER( CHandlerToggleFreeLook, "toggle_free_look"); + +// *************************************************************************** // GCM Move // *************************************************************************** class CHandlerMove : public IActionHandler diff --git a/ryzom/client/src/motion/user_controls.h b/ryzom/client/src/motion/user_controls.h index 1ceabd8d9..7f09ef7f2 100644 --- a/ryzom/client/src/motion/user_controls.h +++ b/ryzom/client/src/motion/user_controls.h @@ -179,6 +179,8 @@ public: /// Stop Free Look (can be called multiple times if needed). Additionaly, the mouse/pointer is restored void stopFreeLook(); + bool getFreeLook() const { return _FreeLook; } + /// Is the camera inside the character. bool isInternalView() {return _InternalView;} -- 2.11.4.GIT