Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: binaries/data/mods/public/gui/session/hotkeys/misc.xml
- ===================================================================
- --- binaries/data/mods/public/gui/session/hotkeys/misc.xml (revision 17965)
- +++ binaries/data/mods/public/gui/session/hotkeys/misc.xml (working copy)
- @@ -2,10 +2,21 @@
- <object>
- <object hotkey="cancel">
- <action on="Press">closeOpenDialogs();</action>
- </object>
- + <object hotkey="cancel">
- + <action on="Press">
- + let list = g_Selection.toList();
- + if (list.length != 1)
- + return;
- +
- + let lookAt = GetEntityState(list[0]).position;
- + Engine.CameraPrintCoordinates(lookAt.x, lookAt.y, lookAt.z);
- + </action>
- + </object>
- +
- <!-- Chat: Depending on the current state, it either opens message window or closes message window / posts message -->
- <object hotkey="chat">
- <action on="Press">toggleChatWindow();</action>
- </object>
- Index: source/graphics/GameView.cpp
- ===================================================================
- --- source/graphics/GameView.cpp (revision 17965)
- +++ source/graphics/GameView.cpp (working copy)
- @@ -905,10 +905,18 @@ float CGameView::GetCameraZ()
- CCamera targetCam = m->ViewCamera;
- CVector3D pivot = GetSmoothPivot(targetCam);
- return pivot.Z;
- }
- +void CGameView::PrintCoordinates(float lookAtX, float lookAtY, float lookAtZ)
- +{
- + debug_printf("\t\t\t<Node deltatime=\"1\">\n");
- + debug_printf("\t\t\t\t<Position x=\"%f\" y=\"%f\" z=\"%f\"/>\n", GetCameraPosX(), GetCameraPosY(), GetCameraPosZ());
- + debug_printf("\t\t\t\t<Target x=\"%f\" y=\"%f\" z=\"%f\"/>\n", lookAtX, lookAtY, lookAtZ);
- + debug_printf("\t\t\t</Node>\n");
- +}
- +
- float CGameView::GetCameraPosX()
- {
- return m->PosX.GetValue();
- }
- Index: source/graphics/GameView.h
- ===================================================================
- --- source/graphics/GameView.h (revision 17965)
- +++ source/graphics/GameView.h (working copy)
- @@ -80,10 +80,11 @@ public:
- void BeginFrame();
- void Render();
- InReaction HandleEvent(const SDL_Event_* ev);
- + void PrintCoordinates(float lookAtX, float lookAtY, float lookAtZ);
- float GetCameraX();
- float GetCameraZ();
- float GetCameraPosX();
- float GetCameraPosY();
- float GetCameraPosZ();
- Index: source/gui/scripting/ScriptFunctions.cpp
- ===================================================================
- --- source/gui/scripting/ScriptFunctions.cpp (revision 17965)
- +++ source/gui/scripting/ScriptFunctions.cpp (working copy)
- @@ -531,10 +531,19 @@ float CameraGetX(ScriptInterface::CxPriv
- return g_Game->GetView()->GetCameraX();
- return -1;
- }
- /**
- + * Print current camera coordinates as XML.
- + */
- +void CameraPrintCoordinates(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float lookAtX, float lookAtY, float lookAtZ)
- +{
- + if (g_Game && g_Game->GetView())
- + g_Game->GetView()->PrintCoordinates(lookAtX, lookAtY, lookAtZ);
- +}
- +
- +/**
- * Get the current Z coordinate of the camera.
- */
- float CameraGetZ(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
- {
- if (g_Game && g_Game->GetView())
- @@ -1059,10 +1068,11 @@ void GuiScriptingInit(ScriptInterface& s
- scriptInterface.RegisterFunction<bool, &IsAtlasRunning>("IsAtlasRunning");
- scriptInterface.RegisterFunction<JS::Value, VfsPath, &LoadMapSettings>("LoadMapSettings");
- scriptInterface.RegisterFunction<JS::Value, &GetMapSettings>("GetMapSettings");
- scriptInterface.RegisterFunction<float, &CameraGetX>("CameraGetX");
- scriptInterface.RegisterFunction<float, &CameraGetZ>("CameraGetZ");
- + scriptInterface.RegisterFunction<void, float, float, float, &CameraPrintCoordinates>("CameraPrintCoordinates");
- scriptInterface.RegisterFunction<void, entity_id_t, &CameraFollow>("CameraFollow");
- scriptInterface.RegisterFunction<void, entity_id_t, &CameraFollowFPS>("CameraFollowFPS");
- scriptInterface.RegisterFunction<void, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t, &SetCameraData>("SetCameraData");
- scriptInterface.RegisterFunction<void, entity_pos_t, entity_pos_t, &CameraMoveTo>("CameraMoveTo");
- scriptInterface.RegisterFunction<entity_id_t, &GetFollowedEntity>("GetFollowedEntity");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement