Fixed #582 (add camera reset command in Atlas), based on patch from stilz
This was SVN commit r8911.
This commit is contained in:
parent
9b25df5958
commit
aa8c3a9ea9
@ -160,6 +160,12 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.GetKeyCode() == 'c')
|
||||
{
|
||||
POST_MESSAGE(CameraReset, ());
|
||||
return;
|
||||
}
|
||||
|
||||
int dir = 0;
|
||||
if (evt.GetKeyCode() == '-' || evt.GetKeyCode() == '_')
|
||||
dir = -1;
|
||||
@ -302,6 +308,7 @@ enum
|
||||
ID_MessageTrace,
|
||||
ID_Screenshot,
|
||||
ID_JavaScript,
|
||||
ID_CameraReset,
|
||||
|
||||
ID_Toolbar // must be last in the list
|
||||
};
|
||||
@ -324,6 +331,7 @@ BEGIN_EVENT_TABLE(ScenarioEditor, wxFrame)
|
||||
EVT_MENU(ID_MessageTrace, ScenarioEditor::OnMessageTrace)
|
||||
EVT_MENU(ID_Screenshot, ScenarioEditor::OnScreenshot)
|
||||
EVT_MENU(ID_JavaScript, ScenarioEditor::OnJavaScript)
|
||||
EVT_MENU(ID_CameraReset, ScenarioEditor::OnCameraReset)
|
||||
|
||||
EVT_IDLE(ScenarioEditor::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
@ -469,6 +477,7 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent, ScriptInterface& scriptInterfac
|
||||
menuMisc->AppendCheckItem(ID_MessageTrace, _("Message debug trace"));
|
||||
menuMisc->Append(ID_Screenshot, _("&Screenshot"));
|
||||
menuMisc->Append(ID_JavaScript, _("&JS console"));
|
||||
menuMisc->Append(ID_CameraReset, _("&Reset camera"));
|
||||
}
|
||||
|
||||
m_FileHistory.Load(*wxConfigBase::Get());
|
||||
@ -754,6 +763,11 @@ void ScenarioEditor::OnJavaScript(wxCommandEvent& WXUNUSED(event))
|
||||
POST_MESSAGE(JavaScript, (cmd.c_str()));
|
||||
}
|
||||
|
||||
void ScenarioEditor::OnCameraReset(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
POST_MESSAGE(CameraReset, ());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Position::Position(const wxPoint& pt)
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
void OnScreenshot(wxCommandEvent& event);
|
||||
void OnMediaPlayer(wxCommandEvent& event);
|
||||
void OnJavaScript(wxCommandEvent& event);
|
||||
void OnCameraReset(wxCommandEvent& event);
|
||||
|
||||
void OpenFile(const wxString& name);
|
||||
|
||||
|
@ -28,10 +28,37 @@
|
||||
#include "graphics/GameView.h"
|
||||
#include "graphics/CinemaTrack.h"
|
||||
|
||||
#include "ps/World.h"
|
||||
#include "graphics/Terrain.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
namespace AtlasMessage {
|
||||
|
||||
MESSAGEHANDLER(CameraReset)
|
||||
{
|
||||
if (g_Game->GetView()->GetCinema()->IsPlaying())
|
||||
return;
|
||||
|
||||
CVector3D focus = g_Game->GetView()->GetCamera()->GetFocus();
|
||||
|
||||
CVector3D target;
|
||||
if (!g_Game->GetWorld()->GetTerrain()->IsOnMap(focus.X, focus.Z))
|
||||
{
|
||||
target = CVector3D(
|
||||
g_Game->GetWorld()->GetTerrain()->GetMaxX()/2.f,
|
||||
focus.Y,
|
||||
g_Game->GetWorld()->GetTerrain()->GetMaxZ()/2.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
target = focus;
|
||||
}
|
||||
|
||||
g_Game->GetView()->ResetCameraTarget(target);
|
||||
|
||||
UNUSED2(msg);
|
||||
}
|
||||
|
||||
MESSAGEHANDLER(ScrollConstant)
|
||||
{
|
||||
|
@ -320,6 +320,8 @@ MESSAGE(LookAt,
|
||||
((Position, target))
|
||||
);
|
||||
|
||||
MESSAGE(CameraReset, );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MESSAGES_SKIP_STRUCTS
|
||||
|
Loading…
Reference in New Issue
Block a user