summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/popups/statuspopup.cpp4
-rw-r--r--src/gui/viewport.cpp19
-rw-r--r--src/gui/viewport.h4
-rw-r--r--src/gui/windows/npcdialog.cpp14
-rw-r--r--src/gui/windows/npcdialog.h2
-rw-r--r--src/gui/windows/statuswindow.cpp4
6 files changed, 19 insertions, 28 deletions
diff --git a/src/gui/popups/statuspopup.cpp b/src/gui/popups/statuspopup.cpp
index 776845bfa..16ea93e42 100644
--- a/src/gui/popups/statuspopup.cpp
+++ b/src/gui/popups/statuspopup.cpp
@@ -137,7 +137,7 @@ void StatusPopup::setLabelText(const int num,
void StatusPopup::updateLabels() const
{
- if (!player_node || !viewport || !modifiers)
+ if (!modifiers)
return;
setLabelText(0, modifiers->getMoveTypeString(),
@@ -168,6 +168,6 @@ void StatusPopup::updateLabels() const
InputAction::CHANGE_IMITATION_MODE);
setLabelText(13, modifiers->getAwayModeString(),
InputAction::AWAY);
- setLabelText(14, LocalPlayer::getCameraModeString(),
+ setLabelText(14, modifiers->getCameraModeString(),
InputAction::CAMERA);
}
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 5a2c9cc91..8acc19ca6 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -80,7 +80,6 @@ Viewport::Viewport() :
mMousePressY(0),
mPixelViewX(0),
mPixelViewY(0),
- mCameraMode(0),
mLocalWalkTime(-1),
mCameraRelativeX(0),
mCameraRelativeY(0),
@@ -410,7 +409,7 @@ bool Viewport::openContextMenu(const MouseEvent &event)
mPopupMenu->showPopup(eventX, eventY, mHoverSign);
return true;
}
- else if (mCameraMode)
+ else if (settings.cameraMode)
{
if (!mMap)
return false;
@@ -1012,10 +1011,10 @@ void Viewport::toggleMapDrawType()
void Viewport::toggleCameraMode()
{
- mCameraMode++;
- if (mCameraMode > 1)
- mCameraMode = 0;
- if (!mCameraMode)
+ settings.cameraMode ++;
+ if (settings.cameraMode > 1)
+ settings.cameraMode = 0;
+ if (!settings.cameraMode)
{
mCameraRelativeX = 0;
mCameraRelativeY = 0;
@@ -1069,7 +1068,7 @@ void Viewport::moveCameraToActor(const int actorId,
return;
const Vector &actorPos = actor->getPosition();
const Vector &playerPos = player_node->getPosition();
- mCameraMode = 1;
+ settings.cameraMode = 1;
mCameraRelativeX = static_cast<int>(actorPos.x - playerPos.x) + x;
mCameraRelativeY = static_cast<int>(actorPos.y - playerPos.y) + y;
}
@@ -1080,7 +1079,7 @@ void Viewport::moveCameraToPosition(const int x, const int y)
return;
const Vector &playerPos = player_node->getPosition();
- mCameraMode = 1;
+ settings.cameraMode = 1;
mCameraRelativeX = x - static_cast<int>(playerPos.x);
mCameraRelativeY = y - static_cast<int>(playerPos.y);
@@ -1088,14 +1087,14 @@ void Viewport::moveCameraToPosition(const int x, const int y)
void Viewport::moveCameraRelative(const int x, const int y)
{
- mCameraMode = 1;
+ settings.cameraMode = 1;
mCameraRelativeX += x;
mCameraRelativeY += y;
}
void Viewport::returnCamera()
{
- mCameraMode = 0;
+ settings.cameraMode = 0;
mCameraRelativeX = 0;
mCameraRelativeY = 0;
}
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 9ed4b3f7f..579821ce6 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -242,9 +242,6 @@ class Viewport final : public WindowContainer,
void scrollBy(const int x, const int y)
{ mPixelViewX += x; mPixelViewY += y; }
- int getCameraMode() const A_WARN_UNUSED
- { return mCameraMode; }
-
/**
* Hides the BeingPopup.
*/
@@ -338,7 +335,6 @@ class Viewport final : public WindowContainer,
int mMousePressY;
int mPixelViewX; /**< Current viewpoint in pixels. */
int mPixelViewY; /**< Current viewpoint in pixels. */
- int mCameraMode; /**< Camera mode. */
int mLocalWalkTime; /**< Timestamp before the next walk can be sent. */
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index fac7714ed..0ccae687b 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -26,6 +26,7 @@
#include "configuration.h"
#include "inventory.h"
#include "item.h"
+#include "settings.h"
#include "soundconsts.h"
#include "soundmanager.h"
@@ -823,7 +824,7 @@ void NpcDialog::saveCamera()
if (!viewport || mCameraMode >= 0)
return;
- mCameraMode = viewport->getCameraMode();
+ mCameraMode = settings.cameraMode;
mCameraX = viewport->getCameraRelativeX();
mCameraY = viewport->getCameraRelativeY();
}
@@ -833,15 +834,10 @@ void NpcDialog::restoreCamera()
if (!viewport || mCameraMode == -1)
return;
- if (!mCameraMode)
+ if (settings.cameraMode != mCameraMode)
+ viewport->toggleCameraMode();
+ if (mCameraMode)
{
- if (viewport->getCameraMode() != mCameraMode)
- viewport->toggleCameraMode();
- }
- else
- {
- if (viewport->getCameraMode() != mCameraMode)
- viewport->toggleCameraMode();
viewport->setCameraRelativeX(mCameraX);
viewport->setCameraRelativeY(mCameraY);
}
diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h
index bd9c21678..7c72550c9 100644
--- a/src/gui/windows/npcdialog.h
+++ b/src/gui/windows/npcdialog.h
@@ -296,7 +296,7 @@ class NpcDialog final : public Window,
PlayerBox *mPlayerBox;
Being *mAvatarBeing;
int mLastNextTime;
- int mCameraMode;
+ unsigned int mCameraMode;
int mCameraX;
int mCameraY;
bool mShowAvatar;
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index c4b645424..cdbf33fe8 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -640,7 +640,7 @@ std::string StatusWindow::translateLetter2(const std::string &letters)
void StatusWindow::updateStatusBar(ProgressBar *const bar,
const bool percent A_UNUSED) const
{
- if (!player_node || !viewport || !modifiers)
+ if (!modifiers)
return;
bar->setText(translateLetter2(modifiers->getMoveTypeString())
@@ -659,7 +659,7 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar,
modifiers->getMapDrawTypeString()))
.append(" ").append(translateLetter2(
modifiers->getImitationModeString()))
- .append(translateLetter2(LocalPlayer::getCameraModeString()))
+ .append(translateLetter2(modifiers->getCameraModeString()))
.append(translateLetter2(modifiers->getAwayModeString())));
bar->setProgress(50);