Merge branch 'dev-right-click-camera' into dev
commit
cbdda57288
|
@ -370,7 +370,9 @@ msgstr ""
|
|||
msgid "Film sequences\\Films before and after the missions"
|
||||
msgstr ""
|
||||
|
||||
msgid "Scrolling\\Scrolling when the mouse touches right or left border"
|
||||
msgid ""
|
||||
"Camera border scrolling\\Scrolling when the mouse touches right or left "
|
||||
"border"
|
||||
msgstr ""
|
||||
|
||||
msgid "Mouse inversion X\\Inversion of the scrolling direction on the X axis"
|
||||
|
|
11
po/de.po
11
po/de.po
|
@ -331,6 +331,13 @@ msgstr "Kamera weiter weg"
|
|||
msgid "Camera back\\Moves the camera backward"
|
||||
msgstr "Kamera weiter\\Bewegung der Kamera rückwärts"
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Camera border scrolling\\Scrolling when the mouse touches right or left "
|
||||
"border"
|
||||
msgstr ""
|
||||
"Kameradrehung mit der Maus\\Die Kamera dreht wenn die Maus den Rand erreicht"
|
||||
|
||||
msgid "Camera closer\\Moves the camera forward"
|
||||
msgstr "Kamera näher\\Bewegung der Kamera vorwärts"
|
||||
|
||||
|
@ -1311,10 +1318,6 @@ msgstr "Speichern\\Aktuelle Mission speichern"
|
|||
msgid "Save\\Saves the current mission"
|
||||
msgstr "Speichern\\Speichert die Mission"
|
||||
|
||||
msgid "Scrolling\\Scrolling when the mouse touches right or left border"
|
||||
msgstr ""
|
||||
"Kameradrehung mit der Maus\\Die Kamera dreht wenn die Maus den Rand erreicht"
|
||||
|
||||
msgid "Select the astronaut\\Selects the astronaut"
|
||||
msgstr "Astronauten auswählen\\Astronauten auswählen"
|
||||
|
||||
|
|
13
po/fr.po
13
po/fr.po
|
@ -324,6 +324,14 @@ msgstr "Caméra plus loin"
|
|||
msgid "Camera back\\Moves the camera backward"
|
||||
msgstr "Caméra plus loin\\Recule la caméra"
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Camera border scrolling\\Scrolling when the mouse touches right or left "
|
||||
"border"
|
||||
msgstr ""
|
||||
"Défilement dans les bords\\Défilement lorsque la souris touches les bords "
|
||||
"gauche ou droite"
|
||||
|
||||
msgid "Camera closer\\Moves the camera forward"
|
||||
msgstr "Caméra plus proche\\Avance la caméra"
|
||||
|
||||
|
@ -1300,11 +1308,6 @@ msgstr "Enregistrer\\Enregistrer la mission en cours"
|
|||
msgid "Save\\Saves the current mission"
|
||||
msgstr "Enregistrer\\Enregistrer la mission en cours"
|
||||
|
||||
msgid "Scrolling\\Scrolling when the mouse touches right or left border"
|
||||
msgstr ""
|
||||
"Défilement dans les bords\\Défilement lorsque la souris touches les bords "
|
||||
"gauche ou droite"
|
||||
|
||||
msgid "Select the astronaut\\Selects the astronaut"
|
||||
msgstr "Sélectionner le cosmonaute\\Sélectionner le cosmonaute"
|
||||
|
||||
|
|
11
po/pl.po
11
po/pl.po
|
@ -334,6 +334,12 @@ msgstr "Camera awayest"
|
|||
msgid "Camera back\\Moves the camera backward"
|
||||
msgstr "Kamera dalej\\Oddala kamerę"
|
||||
|
||||
msgid ""
|
||||
"Camera border scrolling\\Scrolling when the mouse touches right or left "
|
||||
"border"
|
||||
msgstr ""
|
||||
"Przewijanie kamery przy krawędzi\\Ekran jest przewijany gdy mysz dotknie prawej lub lewej jego krawędzi"
|
||||
|
||||
msgid "Camera closer\\Moves the camera forward"
|
||||
msgstr "Kamera bliżej\\Przybliża kamerę"
|
||||
|
||||
|
@ -1307,11 +1313,6 @@ msgstr "Zapisz\\Zapisuje bieżącą misję"
|
|||
msgid "Save\\Saves the current mission"
|
||||
msgstr "Zapisz\\Zapisuje bieżącą misję"
|
||||
|
||||
msgid "Scrolling\\Scrolling when the mouse touches right or left border"
|
||||
msgstr ""
|
||||
"Przewijanie\\Ekran jest przewijany gdy mysz dotknie prawej lub lewej jego "
|
||||
"krawędzi"
|
||||
|
||||
msgid "Select the astronaut\\Selects the astronaut"
|
||||
msgstr "Zaznacz astronautę\\Zaznacza astronautę"
|
||||
|
||||
|
|
9
po/ru.po
9
po/ru.po
|
@ -326,6 +326,12 @@ msgstr "Отдалить камеру"
|
|||
msgid "Camera back\\Moves the camera backward"
|
||||
msgstr "Отдалить камеру\\Перемещение камеры назад"
|
||||
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Camera border scrolling\\Scrolling when the mouse touches right or left "
|
||||
"border"
|
||||
msgstr "Прокрутка\\Прокрутка, когда указатель мыши касается граней экрана"
|
||||
|
||||
msgid "Camera closer\\Moves the camera forward"
|
||||
msgstr "Приблизать камеру\\Перемещение камеры вперед"
|
||||
|
||||
|
@ -1306,9 +1312,6 @@ msgstr "Сохранить\\Сохранить текущую миссию"
|
|||
msgid "Save\\Saves the current mission"
|
||||
msgstr "Сохранить\\Сохранить текущую миссию"
|
||||
|
||||
msgid "Scrolling\\Scrolling when the mouse touches right or left border"
|
||||
msgstr "Прокрутка\\Прокрутка, когда указатель мыши касается граней экрана"
|
||||
|
||||
msgid "Select the astronaut\\Selects the astronaut"
|
||||
msgstr "Выбор астронавта\\Выбор астронавта"
|
||||
|
||||
|
|
|
@ -636,16 +636,6 @@ struct MouseButtonEventData : public EventData
|
|||
MouseButton button = MOUSE_BUTTON_LEFT;
|
||||
};
|
||||
|
||||
/**
|
||||
* \enum WheelDirection
|
||||
* \brief Direction of mouse wheel movement
|
||||
*/
|
||||
enum WheelDirection
|
||||
{
|
||||
WHEEL_UP,
|
||||
WHEEL_DOWN
|
||||
};
|
||||
|
||||
/**
|
||||
* \struct MouseWheelEventData
|
||||
* \brief Additional data for mouse wheel event.
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
#include "common/restext.h"
|
||||
|
||||
#include "common/config.h"
|
||||
|
||||
#include "CBot/CBot.h"
|
||||
|
||||
#include "app/input.h"
|
||||
|
@ -190,7 +188,7 @@ void InitializeRestext()
|
|||
stringsEvent[EVENT_INTERFACE_GLINT] = TR("Reflections on the buttons \\Shiny buttons");
|
||||
stringsEvent[EVENT_INTERFACE_TOOLTIP] = TR("Help balloons\\Explain the function of the buttons");
|
||||
stringsEvent[EVENT_INTERFACE_MOVIES] = TR("Film sequences\\Films before and after the missions");
|
||||
stringsEvent[EVENT_INTERFACE_SCROLL] = TR("Scrolling\\Scrolling when the mouse touches right or left border");
|
||||
stringsEvent[EVENT_INTERFACE_SCROLL] = TR("Camera border scrolling\\Scrolling when the mouse touches right or left border");
|
||||
stringsEvent[EVENT_INTERFACE_INVERTX] = TR("Mouse inversion X\\Inversion of the scrolling direction on the X axis");
|
||||
stringsEvent[EVENT_INTERFACE_INVERTY] = TR("Mouse inversion Y\\Inversion of the scrolling direction on the Y axis");
|
||||
stringsEvent[EVENT_INTERFACE_EFFECT] = TR("Quake at explosions\\The screen shakes at explosions");
|
||||
|
@ -765,7 +763,7 @@ void PutKeyName(std::string& dst, const char* src)
|
|||
src[s+3] == 'y' &&
|
||||
src[s+4] == ' ' )
|
||||
{
|
||||
int count;
|
||||
unsigned int count;
|
||||
for(count = 0; src[s+5+count] != ';'; count++);
|
||||
CInput* input = CInput::GetInstancePointer();
|
||||
InputSlot key = input->SearchKeyById(std::string(&src[s+5], count));
|
||||
|
|
|
@ -80,7 +80,7 @@ void CSettings::SaveSettings()
|
|||
GetConfigFile().SetBoolProperty("Setup", "Soluce4", m_soluce4);
|
||||
GetConfigFile().SetBoolProperty("Setup", "Movies", m_movies);
|
||||
GetConfigFile().SetBoolProperty("Setup", "FocusLostPause", m_focusLostPause);
|
||||
GetConfigFile().SetBoolProperty("Setup", "CameraScroll", camera->GetCameraScroll());
|
||||
GetConfigFile().SetBoolProperty("Setup", "OldCameraScroll", camera->GetOldCameraScroll());
|
||||
GetConfigFile().SetBoolProperty("Setup", "CameraInvertX", camera->GetCameraInvertX());
|
||||
GetConfigFile().SetBoolProperty("Setup", "CameraInvertY", camera->GetCameraInvertY());
|
||||
GetConfigFile().SetBoolProperty("Setup", "InterfaceEffect", camera->GetEffect());
|
||||
|
@ -155,8 +155,8 @@ void CSettings::LoadSettings()
|
|||
GetConfigFile().GetBoolProperty("Setup", "Movies", m_movies);
|
||||
GetConfigFile().GetBoolProperty("Setup", "FocusLostPause", m_focusLostPause);
|
||||
|
||||
if (GetConfigFile().GetBoolProperty("Setup", "CameraScroll", bValue))
|
||||
camera->SetCameraScroll(bValue);
|
||||
if (GetConfigFile().GetBoolProperty("Setup", "OldCameraScroll", bValue))
|
||||
camera->SetOldCameraScroll(bValue);
|
||||
|
||||
if (GetConfigFile().GetBoolProperty("Setup", "CameraInvertX", bValue))
|
||||
camera->SetCameraInvertX(bValue);
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
namespace Gfx
|
||||
{
|
||||
|
||||
const float MOUSE_EDGE_MARGIN = 0.01f;
|
||||
|
||||
//! Changes the level of transparency of an object and objects transported (battery & cargo)
|
||||
void SetTransparency(CObject* obj, float value)
|
||||
|
@ -98,11 +99,6 @@ CCamera::CCamera()
|
|||
m_normLookat = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
m_focus = 1.0f;
|
||||
|
||||
m_rightDown = false;
|
||||
m_rightPosInit = Math::Point(0.5f, 0.5f);
|
||||
m_rightPosCenter = Math::Point(0.5f, 0.5f);
|
||||
m_rightPosMove = Math::Point(0.5f, 0.5f);
|
||||
|
||||
m_eyePt = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
m_directionH = 0.0f;
|
||||
m_directionV = 0.0f;
|
||||
|
@ -124,19 +120,11 @@ CCamera::CCamera()
|
|||
m_visitDist = 0.0f;
|
||||
m_visitTime = 0.0f;
|
||||
m_visitType = CAM_TYPE_NULL;
|
||||
m_visitDirectionH = 0.0f;
|
||||
m_visitDirectionV = 0.0f;
|
||||
|
||||
m_editHeight = 40.0f;
|
||||
|
||||
m_remotePan = 0.0f;
|
||||
m_remoteZoom = 0.0f;
|
||||
|
||||
m_mouseDirH = 0.0f;
|
||||
m_mouseDirV = 0.0f;
|
||||
m_mouseMarging = 0.01f;
|
||||
|
||||
m_motorTurn = 0.0f;
|
||||
|
||||
m_centeringPhase = CAM_PHASE_NULL;
|
||||
m_centeringAngleH = 0.0f;
|
||||
|
@ -156,7 +144,7 @@ CCamera::CCamera()
|
|||
m_overType = CAM_OVER_EFFECT_NULL;
|
||||
m_overForce = 0.0f;
|
||||
m_overTime = 0.0f;
|
||||
m_overMode = 0.0f;
|
||||
m_overMode = 0;
|
||||
m_overFadeIn = 0.0f;
|
||||
m_overFadeOut = 0.0f;
|
||||
|
||||
|
@ -165,7 +153,7 @@ CCamera::CCamera()
|
|||
|
||||
m_effect = true;
|
||||
m_blood = true;
|
||||
m_cameraScroll = true;
|
||||
m_oldCameraScroll = false;
|
||||
m_cameraInvertX = false;
|
||||
m_cameraInvertY = false;
|
||||
}
|
||||
|
@ -194,14 +182,14 @@ bool CCamera::GetBlood()
|
|||
return m_blood;
|
||||
}
|
||||
|
||||
void CCamera::SetCameraScroll(bool scroll)
|
||||
void CCamera::SetOldCameraScroll(bool scroll)
|
||||
{
|
||||
m_cameraScroll = scroll;
|
||||
m_oldCameraScroll = scroll;
|
||||
}
|
||||
|
||||
bool CCamera::GetCameraScroll()
|
||||
bool CCamera::GetOldCameraScroll()
|
||||
{
|
||||
return m_cameraScroll;
|
||||
return m_oldCameraScroll;
|
||||
}
|
||||
|
||||
void CCamera::SetCameraInvertX(bool invert)
|
||||
|
@ -224,13 +212,6 @@ bool CCamera::GetCameraInvertY()
|
|||
return m_cameraInvertY;
|
||||
}
|
||||
|
||||
float CCamera::GetMotorTurn()
|
||||
{
|
||||
if (m_type == CAM_TYPE_BACK)
|
||||
return m_motorTurn;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void CCamera::Init(Math::Vector eye, Math::Vector lookat, float delay)
|
||||
{
|
||||
m_initDelay = delay;
|
||||
|
@ -262,7 +243,6 @@ void CCamera::Init(Math::Vector eye, Math::Vector lookat, float delay)
|
|||
m_scriptLookat = m_actualLookat;
|
||||
m_focus = 1.00f;
|
||||
m_remotePan = 0.0f;
|
||||
m_remoteZoom = 0.0f;
|
||||
|
||||
FlushEffect();
|
||||
FlushOver();
|
||||
|
@ -283,7 +263,6 @@ CObject* CCamera::GetControllingObject()
|
|||
void CCamera::SetType(CameraType type)
|
||||
{
|
||||
m_remotePan = 0.0f;
|
||||
m_remoteZoom = 0.0f;
|
||||
|
||||
if ( (m_type == CAM_TYPE_BACK) && m_transparency )
|
||||
{
|
||||
|
@ -406,7 +385,7 @@ void CCamera::SetSmooth(CameraSmooth type)
|
|||
m_smooth = type;
|
||||
}
|
||||
|
||||
CameraSmooth CCamera::GetSmoth()
|
||||
CameraSmooth CCamera::GetSmooth()
|
||||
{
|
||||
return m_smooth;
|
||||
}
|
||||
|
@ -482,7 +461,6 @@ void CCamera::StartVisit(Math::Vector goal, float dist)
|
|||
m_visitGoal = goal;
|
||||
m_visitDist = dist;
|
||||
m_visitTime = 0.0f;
|
||||
m_visitDirectionH = 0.0f;
|
||||
m_visitDirectionV = -Math::PI*0.10f;
|
||||
}
|
||||
|
||||
|
@ -891,9 +869,8 @@ void CCamera::SetViewTime(const Math::Vector &eyePt,
|
|||
float dist = Math::Distance(m_finalEye, m_actualEye);
|
||||
|
||||
if (m_smooth == CAM_SMOOTH_NONE) prog = dist;
|
||||
if (m_smooth == CAM_SMOOTH_NORM) prog = powf(dist, 1.5f) * rTime * 0.5f;
|
||||
if (m_smooth == CAM_SMOOTH_HARD) prog = powf(dist, 1.0f) * rTime * 4.0f;
|
||||
if (m_smooth == CAM_SMOOTH_SPEC) prog = powf(dist, 1.0f) * rTime * 0.05f;
|
||||
if (m_smooth == CAM_SMOOTH_NORM) prog = dist * rTime * 3.0f;
|
||||
if (m_smooth == CAM_SMOOTH_HARD) prog = dist * rTime * 4.0f;
|
||||
if (dist == 0.0f)
|
||||
{
|
||||
m_actualEye = m_finalEye;
|
||||
|
@ -907,9 +884,8 @@ void CCamera::SetViewTime(const Math::Vector &eyePt,
|
|||
|
||||
dist = Math::Distance(m_finalLookat, m_actualLookat);
|
||||
if ( m_smooth == CAM_SMOOTH_NONE ) prog = dist;
|
||||
if ( m_smooth == CAM_SMOOTH_NORM ) prog = powf(dist, 1.5f) * rTime * 2.0f;
|
||||
if ( m_smooth == CAM_SMOOTH_HARD ) prog = powf(dist, 1.0f) * rTime * 4.0f;
|
||||
if ( m_smooth == CAM_SMOOTH_SPEC ) prog = powf(dist, 1.0f) * rTime * 4.0f;
|
||||
if ( m_smooth == CAM_SMOOTH_NORM ) prog = dist * rTime * 6.0f;
|
||||
if ( m_smooth == CAM_SMOOTH_HARD ) prog = dist * rTime * 4.0f;
|
||||
if ( dist == 0.0f )
|
||||
{
|
||||
m_actualLookat = m_finalLookat;
|
||||
|
@ -1083,6 +1059,11 @@ bool CCamera::EventProcess(const Event &event)
|
|||
EventFrame(event);
|
||||
break;
|
||||
|
||||
case EVENT_MOUSE_BUTTON_DOWN:
|
||||
case EVENT_MOUSE_BUTTON_UP:
|
||||
EventMouseButton(event);
|
||||
break;
|
||||
|
||||
case EVENT_MOUSE_MOVE:
|
||||
EventMouseMove(event);
|
||||
break;
|
||||
|
@ -1099,6 +1080,64 @@ bool CCamera::EventProcess(const Event &event)
|
|||
|
||||
bool CCamera::EventMouseMove(const Event &event)
|
||||
{
|
||||
if (m_engine->GetMouseType() == ENG_MOUSE_SCROLLR ||
|
||||
m_engine->GetMouseType() == ENG_MOUSE_SCROLLL ||
|
||||
m_engine->GetMouseType() == ENG_MOUSE_SCROLLU ||
|
||||
m_engine->GetMouseType() == ENG_MOUSE_SCROLLD ||
|
||||
m_engine->GetMouseType() == ENG_MOUSE_MOVE )
|
||||
{
|
||||
m_engine->SetMouseType(ENG_MOUSE_NORM);
|
||||
}
|
||||
|
||||
if ((event.mouseButtonsState & MOUSE_BUTTON_RIGHT) != 0 || (event.mouseButtonsState & MOUSE_BUTTON_MIDDLE) != 0)
|
||||
{
|
||||
Math::Point newDelta = event.mousePos - m_mousePos;
|
||||
if (m_cameraInvertX)
|
||||
newDelta.x = -newDelta.x;
|
||||
if (m_cameraInvertY)
|
||||
newDelta.y = -newDelta.y;
|
||||
m_mouseDelta += newDelta;
|
||||
|
||||
m_engine->SetMouseType(ENG_MOUSE_MOVE);
|
||||
}
|
||||
|
||||
m_mouseDeltaEdge.LoadZero();
|
||||
if (m_oldCameraScroll)
|
||||
{
|
||||
if (event.mousePos.x < MOUSE_EDGE_MARGIN)
|
||||
m_mouseDeltaEdge.x = event.mousePos.x / MOUSE_EDGE_MARGIN - 1.0f;
|
||||
if (event.mousePos.x > 1.0f - MOUSE_EDGE_MARGIN)
|
||||
m_mouseDeltaEdge.x = 1.0f - (1.0f - event.mousePos.x) / MOUSE_EDGE_MARGIN;
|
||||
if (event.mousePos.y < MOUSE_EDGE_MARGIN)
|
||||
m_mouseDeltaEdge.y = event.mousePos.y / MOUSE_EDGE_MARGIN - 1.0f;
|
||||
if (event.mousePos.y > 1.0f - MOUSE_EDGE_MARGIN)
|
||||
m_mouseDeltaEdge.y = 1.0f - (1.0f - event.mousePos.y) / MOUSE_EDGE_MARGIN;
|
||||
|
||||
if (m_type == CAM_TYPE_FREE ||
|
||||
m_type == CAM_TYPE_EDIT ||
|
||||
m_type == CAM_TYPE_BACK ||
|
||||
m_type == CAM_TYPE_FIX ||
|
||||
m_type == CAM_TYPE_PLANE ||
|
||||
m_type == CAM_TYPE_EXPLO )
|
||||
{
|
||||
if (m_mouseDeltaEdge.x > 0.0f)
|
||||
m_engine->SetMouseType(ENG_MOUSE_SCROLLR);
|
||||
if (m_mouseDeltaEdge.x < 0.0f)
|
||||
m_engine->SetMouseType(ENG_MOUSE_SCROLLL);
|
||||
}
|
||||
if (m_type == CAM_TYPE_FREE ||
|
||||
m_type == CAM_TYPE_EDIT )
|
||||
{
|
||||
if (m_mouseDeltaEdge.y > 0.0f)
|
||||
m_engine->SetMouseType(ENG_MOUSE_SCROLLU);
|
||||
if (m_mouseDeltaEdge.y < 0.0f)
|
||||
m_engine->SetMouseType(ENG_MOUSE_SCROLLD);
|
||||
}
|
||||
|
||||
m_mouseDeltaEdge.x /= 2*Math::PI;
|
||||
m_mouseDeltaEdge.y /= Math::PI;
|
||||
}
|
||||
|
||||
m_mousePos = event.mousePos;
|
||||
return true;
|
||||
}
|
||||
|
@ -1136,8 +1175,30 @@ void CCamera::EventMouseWheel(const Event &event)
|
|||
}
|
||||
}
|
||||
|
||||
void CCamera::EventMouseButton(const Event &event)
|
||||
{
|
||||
if (event.GetData<MouseButtonEventData>()->button == MOUSE_BUTTON_RIGHT || event.GetData<MouseButtonEventData>()->button == MOUSE_BUTTON_MIDDLE)
|
||||
{
|
||||
if ((event.mouseButtonsState & MOUSE_BUTTON_RIGHT) != 0 || (event.mouseButtonsState & MOUSE_BUTTON_MIDDLE) != 0)
|
||||
{
|
||||
m_engine->SetMouseType(ENG_MOUSE_MOVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_engine->SetMouseType(ENG_MOUSE_NORM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CCamera::EventFrame(const Event &event)
|
||||
{
|
||||
Math::Point newDelta = m_mouseDeltaEdge * m_speed * event.rTime;
|
||||
if (m_cameraInvertX)
|
||||
newDelta.x = -newDelta.x;
|
||||
if (m_cameraInvertY)
|
||||
newDelta.y = -newDelta.y;
|
||||
m_mouseDelta += newDelta;
|
||||
|
||||
EffectFrame(event);
|
||||
OverFrame(event);
|
||||
|
||||
|
@ -1175,69 +1236,6 @@ bool CCamera::EventFrame(const Event &event)
|
|||
return true;
|
||||
}
|
||||
|
||||
EngineMouseType CCamera::GetMouseDef(Math::Point pos)
|
||||
{
|
||||
EngineMouseType type = ENG_MOUSE_NORM;
|
||||
m_mousePos = pos;
|
||||
|
||||
if (m_type == CAM_TYPE_INFO)
|
||||
return type;
|
||||
|
||||
if (m_rightDown) // the right button pressed?
|
||||
{
|
||||
m_rightPosMove.x = pos.x - m_rightPosCenter.x;
|
||||
m_rightPosMove.y = pos.y - m_rightPosCenter.y;
|
||||
type = ENG_MOUSE_MOVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_cameraScroll)
|
||||
return type;
|
||||
|
||||
m_mouseDirH = 0.0f;
|
||||
m_mouseDirV = 0.0f;
|
||||
|
||||
if (pos.x < m_mouseMarging)
|
||||
m_mouseDirH = pos.x / m_mouseMarging - 1.0f;
|
||||
|
||||
if (pos.x > 1.0f - m_mouseMarging)
|
||||
m_mouseDirH = 1.0f - (1.0f - pos.x) / m_mouseMarging;
|
||||
|
||||
if (pos.y < m_mouseMarging)
|
||||
m_mouseDirV = pos.y / m_mouseMarging - 1.0f;
|
||||
|
||||
if (pos.y > 1.0f-m_mouseMarging)
|
||||
m_mouseDirV = 1.0f - (1.0f - pos.y) / m_mouseMarging;
|
||||
|
||||
if ( m_type == CAM_TYPE_FREE ||
|
||||
m_type == CAM_TYPE_EDIT ||
|
||||
m_type == CAM_TYPE_BACK ||
|
||||
m_type == CAM_TYPE_FIX ||
|
||||
m_type == CAM_TYPE_PLANE ||
|
||||
m_type == CAM_TYPE_EXPLO )
|
||||
{
|
||||
if (m_mouseDirH > 0.0f)
|
||||
type = ENG_MOUSE_SCROLLR;
|
||||
if (m_mouseDirH < 0.0f)
|
||||
type = ENG_MOUSE_SCROLLL;
|
||||
}
|
||||
|
||||
if ( m_type == CAM_TYPE_FREE ||
|
||||
m_type == CAM_TYPE_EDIT )
|
||||
{
|
||||
if (m_mouseDirV > 0.0f)
|
||||
type = ENG_MOUSE_SCROLLU;
|
||||
if (m_mouseDirV < 0.0f)
|
||||
type = ENG_MOUSE_SCROLLD;
|
||||
}
|
||||
|
||||
if (m_cameraInvertX)
|
||||
m_mouseDirH = -m_mouseDirH;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
bool CCamera::EventFrameFree(const Event &event)
|
||||
{
|
||||
Math::Vector cameraInput = event.cameraInput;
|
||||
|
@ -1248,10 +1246,9 @@ bool CCamera::EventFrameFree(const Event &event)
|
|||
|
||||
float factor = m_heightEye * 0.5f + 30.0f;
|
||||
|
||||
if ( m_mouseDirH != 0.0f )
|
||||
m_directionH -= m_mouseDirH * event.rTime * 0.7f * m_speed;
|
||||
if ( m_mouseDirV != 0.0f )
|
||||
m_eyePt = Math::LookatPoint(m_eyePt, m_directionH, m_directionV, m_mouseDirV * event.rTime * factor * m_speed);
|
||||
m_directionH -= m_mouseDelta.x * 2*Math::PI;
|
||||
m_eyePt = Math::LookatPoint(m_eyePt, m_directionH, m_directionV, m_mouseDelta.y * factor * m_speed);
|
||||
m_mouseDelta.LoadZero();
|
||||
|
||||
// Up/Down
|
||||
m_eyePt = Math::LookatPoint(m_eyePt, m_directionH, m_directionV, cameraInput.y * event.rTime * factor * m_speed);
|
||||
|
@ -1321,17 +1318,13 @@ bool CCamera::EventFrameEdit(const Event &event)
|
|||
{
|
||||
float factor = m_editHeight * 0.5f + 30.0f;
|
||||
|
||||
if (m_mouseDirH != 0.0f)
|
||||
m_directionH -= m_mouseDirH * event.rTime * 0.7f * m_speed;
|
||||
if (m_mouseDirV != 0.0f)
|
||||
m_eyePt = Math::LookatPoint(m_eyePt, m_directionH, m_directionV, m_mouseDirV * event.rTime * factor * m_speed);
|
||||
m_directionH -= m_mouseDelta.x * 0.7f * 2*Math::PI;
|
||||
m_eyePt = Math::LookatPoint(m_eyePt, m_directionH, m_directionV, m_mouseDelta.y * factor * m_speed);
|
||||
|
||||
if (m_cameraScroll)
|
||||
{
|
||||
// Left/Right.
|
||||
m_fixDirectionH += m_mouseDirH * event.rTime * 1.0f * m_speed;
|
||||
m_fixDirectionH += m_mouseDelta.x * 2*Math::PI;
|
||||
m_fixDirectionH = Math::NormAngle(m_fixDirectionH);
|
||||
}
|
||||
|
||||
m_mouseDelta.LoadZero();
|
||||
|
||||
m_terrain->AdjustToBounds(m_eyePt, 10.0f);
|
||||
|
||||
|
@ -1384,25 +1377,11 @@ bool CCamera::EventFrameBack(const Event &event)
|
|||
if (m_backDist > 200.0f) m_backDist = 200.0f;
|
||||
}
|
||||
|
||||
m_motorTurn = 0.0f;
|
||||
|
||||
if (m_rightDown)
|
||||
{
|
||||
m_addDirectionH = m_rightPosMove.x * 6.0f;
|
||||
m_addDirectionV = -m_rightPosMove.y * 2.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_cameraScroll)
|
||||
{
|
||||
// Left/Right
|
||||
m_addDirectionH += m_mouseDirH * event.rTime * 1.0f * m_speed;
|
||||
m_addDirectionH -= m_mouseDelta.x * 2*Math::PI;
|
||||
m_addDirectionH = Math::NormAngle(m_addDirectionH);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_mouseDirH != 0) || (m_mouseDirV != 0))
|
||||
if (m_mouseDelta.Length() > 0)
|
||||
AbortCentering(); // special stops framing
|
||||
m_mouseDelta.LoadZero();
|
||||
|
||||
// Increase the special framework
|
||||
float centeringH = 0.0f;
|
||||
|
@ -1535,21 +1514,19 @@ bool CCamera::EventFrameFix(const Event &event)
|
|||
if (m_fixDist > 200.0f) m_fixDist = 200.0f;
|
||||
}
|
||||
|
||||
m_fixDirectionH -= m_mouseDelta.x * 2*Math::PI;
|
||||
if (m_mouseDelta.Length() > 0)
|
||||
AbortCentering(); // special stops framing
|
||||
m_mouseDelta.LoadZero();
|
||||
|
||||
// Left/Right
|
||||
if (m_cameraScroll)
|
||||
{
|
||||
m_fixDirectionH += m_mouseDirH * event.rTime * 1.0f * m_speed;
|
||||
m_fixDirectionH = Math::NormAngle(m_fixDirectionH);
|
||||
}
|
||||
m_fixDirectionH += event.cameraInput.x * event.rTime * 0.7f * m_speed;
|
||||
m_fixDirectionH = Math::NormAngle(m_fixDirectionH);
|
||||
|
||||
// Up/Down
|
||||
m_fixDirectionV -= event.cameraInput.y * event.rTime * 0.7f * m_speed;
|
||||
m_fixDirectionV = Math::Min(Math::Max(m_fixDirectionV, -0.5*Math::PI), 0.25*Math::PI);
|
||||
|
||||
if ((m_mouseDirH != 0) || (m_mouseDirV != 0))
|
||||
AbortCentering(); // special stops framing
|
||||
|
||||
if (m_cameraObj != nullptr)
|
||||
{
|
||||
Math::Vector lookatPt = m_cameraObj->GetPosition();
|
||||
|
@ -1574,8 +1551,8 @@ bool CCamera::EventFrameFix(const Event &event)
|
|||
|
||||
bool CCamera::EventFrameExplo(const Event &event)
|
||||
{
|
||||
if (m_mouseDirH != 0.0f)
|
||||
m_directionH -= m_mouseDirH * event.rTime * 0.7f * m_speed;
|
||||
m_directionH -= m_mouseDelta.x * 2*Math::PI;
|
||||
m_mouseDelta.LoadZero();
|
||||
|
||||
m_terrain->AdjustToBounds(m_eyePt, 10.0f);
|
||||
|
||||
|
@ -1656,12 +1633,10 @@ bool CCamera::EventFrameVisit(const Event &event)
|
|||
if (m_visitDirectionV > 0.0f ) m_visitDirectionV = 0.0f;
|
||||
}
|
||||
|
||||
if (m_cameraScroll)
|
||||
{
|
||||
m_visitDist -= m_mouseDirV * event.rTime * 30.0f * m_speed;
|
||||
m_visitDist -= m_mouseDelta.y * 100.0f * m_speed;
|
||||
m_mouseDelta.LoadZero();
|
||||
if (m_visitDist < 20.0f) m_visitDist = 20.0f;
|
||||
if (m_visitDist > 200.0f) m_visitDist = 200.0f;
|
||||
}
|
||||
|
||||
float angleH = (m_visitTime / 10.0f) * (Math::PI * 2.0f);
|
||||
float angleV = m_visitDirectionV;
|
||||
|
@ -1751,5 +1726,4 @@ void CCamera::SetCameraSpeed(float speed)
|
|||
m_speed = speed;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -77,8 +77,6 @@ enum CameraSmooth
|
|||
CAM_SMOOTH_NORM = 1,
|
||||
//! Hard
|
||||
CAM_SMOOTH_HARD = 2,
|
||||
//! Special
|
||||
CAM_SMOOTH_SPEC = 3,
|
||||
};
|
||||
|
||||
enum CenteringPhase
|
||||
|
@ -151,7 +149,7 @@ public:
|
|||
|
||||
//! Management of the smoothing mode
|
||||
void SetSmooth(CameraSmooth type);
|
||||
CameraSmooth GetSmoth();
|
||||
CameraSmooth GetSmooth();
|
||||
|
||||
//! Management of the setback distance
|
||||
void SetDist(float dist);
|
||||
|
@ -206,18 +204,13 @@ public:
|
|||
bool GetEffect();
|
||||
void SetBlood(bool enable);
|
||||
bool GetBlood();
|
||||
void SetCameraScroll(bool scroll);
|
||||
bool GetCameraScroll();
|
||||
void SetOldCameraScroll(bool scroll);
|
||||
bool GetOldCameraScroll();
|
||||
void SetCameraInvertX(bool invert);
|
||||
bool GetCameraInvertX();
|
||||
void SetCameraInvertY(bool invert);
|
||||
bool GetCameraInvertY();
|
||||
|
||||
//! Returns an additional force to turn
|
||||
float GetMotorTurn();
|
||||
//! Returns the default sprite to use for the mouse
|
||||
EngineMouseType GetMouseDef(Math::Point pos);
|
||||
|
||||
void SetCameraSpeed(float speed);
|
||||
|
||||
protected:
|
||||
|
@ -225,6 +218,8 @@ protected:
|
|||
bool EventMouseMove(const Event &event);
|
||||
//! Mouse wheel operation
|
||||
void EventMouseWheel(const Event &event);
|
||||
//! Mouse button handling
|
||||
void EventMouseButton(const Event &event);
|
||||
//! Changes the camera according to the time elapsed
|
||||
bool EventFrame(const Event &event);
|
||||
//! Moves the point of view
|
||||
|
@ -303,11 +298,6 @@ protected:
|
|||
|
||||
float m_focus;
|
||||
|
||||
bool m_rightDown;
|
||||
Math::Point m_rightPosInit;
|
||||
Math::Point m_rightPosCenter;
|
||||
Math::Point m_rightPosMove;
|
||||
|
||||
//! CAM_TYPE_FREE: eye
|
||||
Math::Vector m_eyePt;
|
||||
//! CAM_TYPE_FREE: horizontal direction
|
||||
|
@ -347,22 +337,17 @@ protected:
|
|||
//! CAM_TYPE_VISIT: initial type
|
||||
CameraType m_visitType;
|
||||
//! CAM_TYPE_VISIT: direction
|
||||
float m_visitDirectionH;
|
||||
//! CAM_TYPE_VISIT: direction
|
||||
float m_visitDirectionV;
|
||||
|
||||
//! CAM_TYPE_EDIT: height
|
||||
float m_editHeight;
|
||||
|
||||
float m_remotePan;
|
||||
float m_remoteZoom;
|
||||
|
||||
Math::Point m_mousePos;
|
||||
float m_mouseDirH;
|
||||
float m_mouseDirV;
|
||||
float m_mouseMarging;
|
||||
|
||||
float m_motorTurn;
|
||||
//! Last known mouse position, used to calculate change since last frame
|
||||
Math::Point m_mousePos = Math::Point(0.5f, 0.5f);
|
||||
Math::Point m_mouseDelta = Math::Point(0.0f, 0.0f);
|
||||
Math::Point m_mouseDeltaEdge = Math::Point(0.0f, 0.0f);
|
||||
|
||||
CenteringPhase m_centeringPhase;
|
||||
float m_centeringAngleH;
|
||||
|
@ -396,12 +381,11 @@ protected:
|
|||
//! Blood?
|
||||
bool m_blood;
|
||||
//! Scroll in the edges?
|
||||
bool m_cameraScroll;
|
||||
bool m_oldCameraScroll;
|
||||
//! X inversion in the edges?
|
||||
bool m_cameraInvertX;
|
||||
//! Y inversion in the edges?
|
||||
bool m_cameraInvertY;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -683,7 +683,6 @@ bool CRobotMain::ProcessEvent(Event &event)
|
|||
m_displayText->EventProcess(event);
|
||||
RemoteCamera(m_cameraPan, m_cameraZoom, event.rTime);
|
||||
|
||||
m_interface->EventProcess(event);
|
||||
if (m_displayInfo != nullptr) // current edition?
|
||||
m_displayInfo->EventProcess(event);
|
||||
|
||||
|
|
|
@ -2051,7 +2051,6 @@ bool COldObject::EventProcess(const Event &event)
|
|||
axeZ = -1.0f; // tomb
|
||||
}
|
||||
|
||||
axeX += m_camera->GetMotorTurn(); // additional power according to camera
|
||||
if ( axeX > 1.0f ) axeX = 1.0f;
|
||||
if ( axeX < -1.0f ) axeX = -1.0f;
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ bool CControl::EventProcess(const Event &event)
|
|||
GlintFrame(event);
|
||||
}
|
||||
|
||||
if ( event.type == EVENT_MOUSE_MOVE )
|
||||
if ( event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP )
|
||||
{
|
||||
m_glintMouse = event.mousePos;
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ bool CEdit::EventProcess(const Event &event)
|
|||
m_timeBlink += event.rTime;
|
||||
}
|
||||
|
||||
if ( event.type == EVENT_MOUSE_MOVE )
|
||||
if ( event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP )
|
||||
{
|
||||
if ( Detect(event.mousePos) &&
|
||||
event.mousePos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
|
||||
|
|
|
@ -54,7 +54,6 @@ CInterface::CInterface()
|
|||
{
|
||||
m_event = CApplication::GetInstancePointer()->GetEventQueue();
|
||||
m_engine = Gfx::CEngine::GetInstancePointer();
|
||||
m_camera = nullptr;
|
||||
}
|
||||
|
||||
// Object's destructor.
|
||||
|
@ -300,12 +299,9 @@ CControl* CInterface::SearchControl(EventType eventMsg)
|
|||
|
||||
bool CInterface::EventProcess(const Event &event)
|
||||
{
|
||||
if (event.type == EVENT_MOUSE_MOVE)
|
||||
if (event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP)
|
||||
{
|
||||
if (m_camera == nullptr)
|
||||
m_camera = CRobotMain::GetInstancePointer()->GetCamera();
|
||||
|
||||
m_engine->SetMouseType(m_camera->GetMouseDef(event.mousePos));
|
||||
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
|
||||
}
|
||||
|
||||
for (auto& control : boost::adaptors::reverse(m_controls))
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
namespace Gfx
|
||||
{
|
||||
class CCamera;
|
||||
class CEngine;
|
||||
} // namespace Gfx
|
||||
|
||||
|
@ -101,7 +100,6 @@ protected:
|
|||
|
||||
CEventQueue* m_event;
|
||||
Gfx::CEngine* m_engine;
|
||||
Gfx::CCamera* m_camera;
|
||||
std::array<std::unique_ptr<CControl>, MAXCONTROL> m_controls;
|
||||
};
|
||||
|
||||
|
|
|
@ -293,7 +293,9 @@ bool CList::EventProcess(const Event &event)
|
|||
|
||||
CControl::EventProcess(event);
|
||||
|
||||
if (event.type == EVENT_MOUSE_MOVE && Detect(event.mousePos))
|
||||
if (event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP)
|
||||
{
|
||||
if (Detect(event.mousePos))
|
||||
{
|
||||
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
|
||||
for (int i = 0; i < m_displayLine; i++)
|
||||
|
@ -304,6 +306,7 @@ bool CList::EventProcess(const Event &event)
|
|||
m_buttons[i]->EventProcess(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bSelectCap)
|
||||
{
|
||||
|
|
|
@ -203,13 +203,16 @@ bool CMap::EventProcess(const Event &event)
|
|||
if ( event.type == EVENT_FRAME )
|
||||
m_time += event.rTime;
|
||||
|
||||
if ( event.type == EVENT_MOUSE_MOVE && Detect(event.mousePos) )
|
||||
if ( event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP )
|
||||
{
|
||||
if (Detect(event.mousePos))
|
||||
{
|
||||
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
|
||||
bool inMap = false;
|
||||
if (DetectObject(event.mousePos, inMap) != nullptr)
|
||||
m_engine->SetMouseType(Gfx::ENG_MOUSE_HAND);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.type == EVENT_MOUSE_BUTTON_DOWN &&
|
||||
event.GetData<MouseButtonEventData>()->button == MOUSE_BUTTON_LEFT)
|
||||
|
|
|
@ -64,7 +64,7 @@ bool CTarget::EventProcess(const Event &event)
|
|||
|
||||
CControl::EventProcess(event);
|
||||
|
||||
if ( event.type == EVENT_MOUSE_MOVE )
|
||||
if ( event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP )
|
||||
{
|
||||
m_main->SetFriendAim(false);
|
||||
|
||||
|
|
|
@ -662,7 +662,7 @@ int CWindow::BorderDetect(Math::Point pos)
|
|||
|
||||
bool CWindow::EventProcess(const Event &event)
|
||||
{
|
||||
if ( event.type == EVENT_MOUSE_MOVE )
|
||||
if ( event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP )
|
||||
{
|
||||
if ( m_bCapture )
|
||||
{
|
||||
|
|
|
@ -214,7 +214,7 @@ bool CScreenSetupGame::EventProcess(const Event &event)
|
|||
break;
|
||||
|
||||
case EVENT_INTERFACE_SCROLL:
|
||||
m_camera->SetCameraScroll(!m_camera->GetCameraScroll());
|
||||
m_camera->SetOldCameraScroll(!m_camera->GetOldCameraScroll());
|
||||
ChangeSetupButtons();
|
||||
UpdateSetupButtons();
|
||||
break;
|
||||
|
@ -325,7 +325,7 @@ void CScreenSetupGame::UpdateSetupButtons()
|
|||
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SCROLL));
|
||||
if ( pc != nullptr )
|
||||
{
|
||||
pc->SetState(STATE_CHECK, m_camera->GetCameraScroll());
|
||||
pc->SetState(STATE_CHECK, m_camera->GetOldCameraScroll());
|
||||
}
|
||||
|
||||
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_INVERTX));
|
||||
|
|
Loading…
Reference in New Issue