Restored old camera scroll as a config option

dev-time-step
krzys-h 2016-02-19 16:46:33 +01:00
parent 1efa4b132c
commit b15666f48e
12 changed files with 141 additions and 69 deletions

View File

@ -370,6 +370,9 @@ msgstr ""
msgid "Film sequences\\Films before and after the missions"
msgstr ""
msgid "Scrolling\\Scrolling when the mouse touches right or left border"
msgstr ""
msgid "Mouse inversion X\\Inversion of the scrolling direction on the X axis"
msgstr ""

View File

@ -1311,6 +1311,10 @@ 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"
@ -1901,11 +1905,6 @@ msgstr "www.epsitec.com"
#~ msgid "Robbie\\Your assistant"
#~ msgstr "Robby\\Ihr Assistent"
#~ 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 "Sky\\Clouds and nebulae"
#~ msgstr "Himmel\\Himmel und Wolken"

View File

@ -1299,6 +1299,11 @@ 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"
@ -1887,11 +1892,6 @@ msgstr "www.epsitec.com"
#~ msgid "Robbie\\Your assistant"
#~ msgstr "Robbie\\Votre assistant"
#~ 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 "Sky\\Clouds and nebulae"
#~ msgstr "Ciel\\Ciel et nuages"

View File

@ -1307,6 +1307,11 @@ 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ę"
@ -1880,11 +1885,6 @@ msgstr "www.epsitec.com"
#~ msgid "Robbie\\Your assistant"
#~ msgstr "Robbie\\Twój asystent"
#~ 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 "Sky\\Clouds and nebulae"
#~ msgstr "Niebo\\Chmury i mgławice"

View File

@ -1306,6 +1306,9 @@ 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 "Выбор астронавта\\Выбор астронавта"
@ -1893,9 +1896,6 @@ msgstr "www.epsitec.com"
#~ msgid "Robbie\\Your assistant"
#~ msgstr "Робби\\Ваш помощник"
#~ msgid "Scrolling\\Scrolling when the mouse touches right or left border"
#~ msgstr "Прокрутка\\Прокрутка, когда указатель мыши касается граней экрана"
#~ msgid "Sky\\Clouds and nebulae"
#~ msgstr "Небо\\Облака и туманности"

View File

@ -208,6 +208,7 @@ void InitializeEventTypeTexts()
EVENT_TYPE_TEXT[EVENT_INTERFACE_GLINT] = "EVENT_INTERFACE_GLINT";
EVENT_TYPE_TEXT[EVENT_INTERFACE_TOOLTIP] = "EVENT_INTERFACE_TOOLTIP";
EVENT_TYPE_TEXT[EVENT_INTERFACE_MOVIES] = "EVENT_INTERFACE_MOVIES";
EVENT_TYPE_TEXT[EVENT_INTERFACE_SCROLL] = "EVENT_INTERFACE_SCROLL";
EVENT_TYPE_TEXT[EVENT_INTERFACE_INVERTX] = "EVENT_INTERFACE_INVERTX";
EVENT_TYPE_TEXT[EVENT_INTERFACE_INVERTY] = "EVENT_INTERFACE_INVERTY";
EVENT_TYPE_TEXT[EVENT_INTERFACE_EFFECT] = "EVENT_INTERFACE_EFFECT";

View File

@ -237,6 +237,7 @@ enum EventType
EVENT_INTERFACE_GLINT = 463,
EVENT_INTERFACE_TOOLTIP = 464,
EVENT_INTERFACE_MOVIES = 465,
EVENT_INTERFACE_SCROLL = 467,
EVENT_INTERFACE_INVERTX = 468,
EVENT_INTERFACE_INVERTY = 469,
EVENT_INTERFACE_EFFECT = 470,

View File

@ -20,8 +20,6 @@
#include "common/restext.h"
#include "common/config.h"
#include "CBot/CBot.h"
#include "app/input.h"
@ -190,6 +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("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");
@ -764,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));

View File

@ -80,6 +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", "OldCameraScroll", camera->GetOldCameraScroll());
GetConfigFile().SetBoolProperty("Setup", "CameraInvertX", camera->GetCameraInvertX());
GetConfigFile().SetBoolProperty("Setup", "CameraInvertY", camera->GetCameraInvertY());
GetConfigFile().SetBoolProperty("Setup", "InterfaceEffect", camera->GetEffect());
@ -151,6 +152,9 @@ void CSettings::LoadSettings()
GetConfigFile().GetBoolProperty("Setup", "Movies", m_movies);
GetConfigFile().GetBoolProperty("Setup", "FocusLostPause", m_focusLostPause);
if (GetConfigFile().GetBoolProperty("Setup", "OldCameraScroll", bValue))
camera->SetOldCameraScroll(bValue);
if (GetConfigFile().GetBoolProperty("Setup", "CameraInvertX", bValue))
camera->SetCameraInvertX(bValue);

View File

@ -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)
@ -152,6 +153,7 @@ CCamera::CCamera()
m_effect = true;
m_blood = true;
m_oldCameraScroll = false;
m_cameraInvertX = false;
m_cameraInvertY = false;
}
@ -180,6 +182,16 @@ bool CCamera::GetBlood()
return m_blood;
}
void CCamera::SetOldCameraScroll(bool scroll)
{
m_oldCameraScroll = scroll;
}
bool CCamera::GetOldCameraScroll()
{
return m_oldCameraScroll;
}
void CCamera::SetCameraInvertX(bool invert)
{
m_cameraInvertX = invert;
@ -1068,16 +1080,62 @@ bool CCamera::EventProcess(const Event &event)
bool CCamera::EventMouseMove(const Event &event)
{
m_mouseDelta += (event.mousePos - m_mousePos);
if (m_cameraInvertX)
m_mouseDelta.x = -m_mouseDelta.x;
if (m_cameraInvertY)
m_mouseDelta.y = -m_mouseDelta.y;
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)
{
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_mousePos = event.mousePos;
if (m_mouseRightDown)
m_engine->SetMouseType(ENG_MOUSE_MOVE);
return true;
}
@ -1120,13 +1178,10 @@ void CCamera::EventMouseButton(const Event &event)
{
if (event.type == EVENT_MOUSE_BUTTON_DOWN)
{
m_mouseRightDown = true;
m_mouseDelta.LoadZero();
m_engine->SetMouseType(ENG_MOUSE_MOVE);
}
else
{
m_mouseRightDown = false;
m_engine->SetMouseType(ENG_MOUSE_NORM);
}
}
@ -1134,6 +1189,13 @@ void CCamera::EventMouseButton(const Event &event)
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);
@ -1181,12 +1243,9 @@ bool CCamera::EventFrameFree(const Event &event)
float factor = m_heightEye * 0.5f + 30.0f;
if ( m_mouseRightDown )
{
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();
}
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);
@ -1256,12 +1315,10 @@ bool CCamera::EventFrameEdit(const Event &event)
{
float factor = m_editHeight * 0.5f + 30.0f;
if (m_mouseRightDown)
{
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();
}
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();
m_fixDirectionH = Math::NormAngle(m_fixDirectionH);
m_terrain->AdjustToBounds(m_eyePt, 10.0f);
@ -1315,13 +1372,11 @@ bool CCamera::EventFrameBack(const Event &event)
if (m_backDist > 200.0f) m_backDist = 200.0f;
}
if (m_mouseRightDown)
{
m_addDirectionH -= m_mouseDelta.x * 2*Math::PI;
m_addDirectionH = Math::NormAngle(m_addDirectionH);
m_mouseDelta.LoadZero();
m_addDirectionH -= m_mouseDelta.x * 2*Math::PI;
m_addDirectionH = Math::NormAngle(m_addDirectionH);
if (m_mouseDelta.Length() > 0)
AbortCentering(); // special stops framing
}
m_mouseDelta.LoadZero();
// Increase the special framework
float centeringH = 0.0f;
@ -1454,12 +1509,10 @@ bool CCamera::EventFrameFix(const Event &event)
if (m_fixDist > 200.0f) m_fixDist = 200.0f;
}
if (m_mouseRightDown)
{
m_fixDirectionH -= m_mouseDelta.x * 2*Math::PI;
m_mouseDelta.LoadZero();
m_fixDirectionH -= m_mouseDelta.x * 2*Math::PI;
if (m_mouseDelta.Length() > 0)
AbortCentering(); // special stops framing
}
m_mouseDelta.LoadZero();
// Left/Right
m_fixDirectionH += event.cameraInput.x * event.rTime * 0.7f * m_speed;
@ -1493,11 +1546,8 @@ bool CCamera::EventFrameFix(const Event &event)
bool CCamera::EventFrameExplo(const Event &event)
{
if (m_mouseRightDown)
{
m_directionH -= m_mouseDelta.x * 2*Math::PI;
m_mouseDelta.LoadZero();
}
m_directionH -= m_mouseDelta.x * 2*Math::PI;
m_mouseDelta.LoadZero();
m_terrain->AdjustToBounds(m_eyePt, 10.0f);
@ -1578,13 +1628,10 @@ bool CCamera::EventFrameVisit(const Event &event)
if (m_visitDirectionV > 0.0f ) m_visitDirectionV = 0.0f;
}
if (m_mouseRightDown)
{
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;
}
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;

View File

@ -204,6 +204,8 @@ public:
bool GetEffect();
void SetBlood(bool enable);
bool GetBlood();
void SetOldCameraScroll(bool scroll);
bool GetOldCameraScroll();
void SetCameraInvertX(bool invert);
bool GetCameraInvertX();
void SetCameraInvertY(bool invert);
@ -342,9 +344,10 @@ protected:
float m_remotePan;
bool m_mouseRightDown = false;
//! 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;
@ -378,7 +381,7 @@ 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?

View File

@ -69,6 +69,9 @@ void CScreenSetupGame::CreateInterface()
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_MOVIES);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SCROLL);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_INVERTX);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
@ -210,6 +213,12 @@ bool CScreenSetupGame::EventProcess(const Event &event)
UpdateSetupButtons();
break;
case EVENT_INTERFACE_SCROLL:
m_camera->SetOldCameraScroll(!m_camera->GetOldCameraScroll());
ChangeSetupButtons();
UpdateSetupButtons();
break;
case EVENT_INTERFACE_INVERTX:
m_camera->SetCameraInvertX(!m_camera->GetCameraInvertX());
ChangeSetupButtons();
@ -313,6 +322,12 @@ void CScreenSetupGame::UpdateSetupButtons()
pc->SetState(STATE_CHECK, m_settings->GetMovies());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SCROLL));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_camera->GetOldCameraScroll());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_INVERTX));
if ( pc != nullptr )
{