1 | Index: trunk/binaries/data/mods/public/gui/session/menu.js
|
---|
2 | ===================================================================
|
---|
3 | --- trunk/binaries/data/mods/public/gui/session/menu.js (revision 17774)
|
---|
4 | +++ trunk/binaries/data/mods/public/gui/session/menu.js (working copy)
|
---|
5 | @@ -197,7 +197,7 @@
|
---|
6 | }
|
---|
7 |
|
---|
8 | function openChat()
|
---|
9 | -{
|
---|
10 | +{
|
---|
11 | if (g_Disconnected)
|
---|
12 | return;
|
---|
13 |
|
---|
14 | @@ -214,6 +214,7 @@
|
---|
15 | Engine.GetGUIObjectByName("chatInput").caption = ""; // Clear chat input
|
---|
16 | Engine.GetGUIObjectByName("chatInput").blur(); // Remove focus
|
---|
17 | Engine.GetGUIObjectByName("chatDialogPanel").hidden = true;
|
---|
18 | + Engine.CameraSetOption("hotkeyLocked", "false" );
|
---|
19 | }
|
---|
20 |
|
---|
21 | /**
|
---|
22 | @@ -256,6 +257,7 @@
|
---|
23 | }
|
---|
24 |
|
---|
25 | chatWindow.hidden = !hidden;
|
---|
26 | + Engine.CameraSetOption("hotkeyLocked", chatWindow.hidden ? "false" : "true");
|
---|
27 | }
|
---|
28 |
|
---|
29 | function setDiplomacy(data)
|
---|
30 | Index: trunk/source/graphics/GameView.cpp
|
---|
31 | ===================================================================
|
---|
32 | --- trunk/source/graphics/GameView.cpp (revision 17774)
|
---|
33 | +++ trunk/source/graphics/GameView.cpp (working copy)
|
---|
34 | @@ -292,6 +292,9 @@
|
---|
35 | float ViewFOV;
|
---|
36 | float ViewNear;
|
---|
37 | float ViewFar;
|
---|
38 | + struct {
|
---|
39 | + bool isHotkeyLock = false;
|
---|
40 | + } view;
|
---|
41 | int JoystickPanX;
|
---|
42 | int JoystickPanY;
|
---|
43 | int JoystickRotateX;
|
---|
44 | @@ -640,14 +643,17 @@
|
---|
45 | mouse_last_x = g_mouse_x;
|
---|
46 | mouse_last_y = g_mouse_y;
|
---|
47 |
|
---|
48 | - if (HotkeyIsPressed("camera.rotate.cw"))
|
---|
49 | - m->RotateY.AddSmoothly(m->ViewRotateYSpeed * deltaRealTime);
|
---|
50 | - if (HotkeyIsPressed("camera.rotate.ccw"))
|
---|
51 | - m->RotateY.AddSmoothly(-m->ViewRotateYSpeed * deltaRealTime);
|
---|
52 | - if (HotkeyIsPressed("camera.rotate.up"))
|
---|
53 | - m->RotateX.AddSmoothly(-m->ViewRotateXSpeed * deltaRealTime);
|
---|
54 | - if (HotkeyIsPressed("camera.rotate.down"))
|
---|
55 | - m->RotateX.AddSmoothly(m->ViewRotateXSpeed * deltaRealTime);
|
---|
56 | + if (!m->view.isHotkeyLock)
|
---|
57 | + {
|
---|
58 | + if (HotkeyIsPressed("camera.rotate.cw"))
|
---|
59 | + m->RotateY.AddSmoothly(m->ViewRotateYSpeed * deltaRealTime);
|
---|
60 | + if (HotkeyIsPressed("camera.rotate.ccw"))
|
---|
61 | + m->RotateY.AddSmoothly(-m->ViewRotateYSpeed * deltaRealTime);
|
---|
62 | + if (HotkeyIsPressed("camera.rotate.up"))
|
---|
63 | + m->RotateX.AddSmoothly(-m->ViewRotateXSpeed * deltaRealTime);
|
---|
64 | + if (HotkeyIsPressed("camera.rotate.down"))
|
---|
65 | + m->RotateX.AddSmoothly(m->ViewRotateXSpeed * deltaRealTime);
|
---|
66 | + }
|
---|
67 |
|
---|
68 | float moveRightward = 0.f;
|
---|
69 | float moveForward = 0.f;
|
---|
70 | @@ -893,6 +899,22 @@
|
---|
71 | m->ViewCamera.UpdateFrustum();
|
---|
72 | }
|
---|
73 |
|
---|
74 | +std::wstring CGameView::GetCameraOption(const std::wstring& optionName)
|
---|
75 | +{
|
---|
76 | + if (L"hotkeyLocked" == optionName)
|
---|
77 | + return m->view.isHotkeyLock ? L"true" : L"false";
|
---|
78 | +
|
---|
79 | + return L"";
|
---|
80 | +}
|
---|
81 | +
|
---|
82 | +void CGameView::SetCameraOption(const std::wstring& optionName, const std::wstring& optionValue)
|
---|
83 | +{
|
---|
84 | + if (L"hotkeyLocked" == optionName)
|
---|
85 | + m->view.isHotkeyLock = (optionValue == L"true");
|
---|
86 | +}
|
---|
87 | +
|
---|
88 | float CGameView::GetCameraX()
|
---|
89 | {
|
---|
90 | CCamera targetCam = m->ViewCamera;
|
---|
91 | Index: trunk/source/graphics/GameView.h
|
---|
92 | ===================================================================
|
---|
93 | --- trunk/source/graphics/GameView.h (revision 17774)
|
---|
94 | +++ trunk/source/graphics/GameView.h (working copy)
|
---|
95 | @@ -90,6 +90,8 @@
|
---|
96 | float GetCameraRotX();
|
---|
97 | float GetCameraRotY();
|
---|
98 | float GetCameraZoom();
|
---|
99 | + std::wstring GetCameraOption(const std::wstring& optionName);
|
---|
100 | + void SetCameraOption(const std::wstring& optionName, const std::wstring& optionValue);
|
---|
101 | void SetCamera(CVector3D Pos, float RotX, float RotY, float Zoom);
|
---|
102 | void MoveCameraTarget(const CVector3D& target);
|
---|
103 | void ResetCameraTarget(const CVector3D& target);
|
---|
104 | Index: trunk/source/gui/scripting/ScriptFunctions.cpp
|
---|
105 | ===================================================================
|
---|
106 | --- trunk/source/gui/scripting/ScriptFunctions.cpp (revision 17774)
|
---|
107 | +++ trunk/source/gui/scripting/ScriptFunctions.cpp (working copy)
|
---|
108 | @@ -532,6 +532,20 @@
|
---|
109 | return -1;
|
---|
110 | }
|
---|
111 |
|
---|
112 | +std::wstring CameraGetOption(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& optionName)
|
---|
113 | +{
|
---|
114 | + if (g_Game && g_Game->GetView())
|
---|
115 | + return g_Game->GetView()->GetCameraOption(optionName);
|
---|
116 | +
|
---|
117 | + return wstring_from_utf8("");
|
---|
118 | +}
|
---|
119 | +
|
---|
120 | +void CameraSetOption(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& optionName, const std::wstring& optionValue)
|
---|
121 | +{
|
---|
122 | + if (g_Game && g_Game->GetView())
|
---|
123 | + g_Game->GetView()->SetCameraOption(optionName, optionValue);
|
---|
124 | +}
|
---|
125 | +
|
---|
126 | /**
|
---|
127 | * Get the current Z coordinate of the camera.
|
---|
128 | */
|
---|
129 | @@ -1061,6 +1075,8 @@
|
---|
130 | scriptInterface.RegisterFunction<JS::Value, &GetMapSettings>("GetMapSettings");
|
---|
131 | scriptInterface.RegisterFunction<float, &CameraGetX>("CameraGetX");
|
---|
132 | scriptInterface.RegisterFunction<float, &CameraGetZ>("CameraGetZ");
|
---|
133 | + scriptInterface.RegisterFunction<std::wstring, std::wstring, &CameraGetOption>("CameraGetOption");
|
---|
134 | + scriptInterface.RegisterFunction<void, std::wstring, std::wstring, &CameraSetOption>("CameraSetOption");
|
---|
135 | scriptInterface.RegisterFunction<void, entity_id_t, &CameraFollow>("CameraFollow");
|
---|
136 | scriptInterface.RegisterFunction<void, entity_id_t, &CameraFollowFPS>("CameraFollowFPS");
|
---|
137 | scriptInterface.RegisterFunction<void, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t, &SetCameraData>("SetCameraData");
|
---|