summaryrefslogtreecommitdiff
path: root/src/gui/viewport.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-05 03:23:24 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-05 03:23:24 +0300
commit3f43bdd12b50a2ff3afb687fd3d2101865e946f2 (patch)
tree218051a0398f77ea3ca555ba706daea82a32f8e0 /src/gui/viewport.cpp
parent31782ba3cdeced9baa91739c55e9ae819d70d616 (diff)
downloadmv-3f43bdd12b50a2ff3afb687fd3d2101865e946f2.tar.gz
mv-3f43bdd12b50a2ff3afb687fd3d2101865e946f2.tar.bz2
mv-3f43bdd12b50a2ff3afb687fd3d2101865e946f2.tar.xz
mv-3f43bdd12b50a2ff3afb687fd3d2101865e946f2.zip
Use in most places int being positions and not float.
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r--src/gui/viewport.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 23afa9bfd..7dddb4414 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -141,9 +141,8 @@ void Viewport::draw(Graphics *const graphics)
// Calculate viewpoint
- const Vector &playerPos = localPlayer->getPixelPositionF();
- const int player_x = CAST_S32(playerPos.x) - mMidTileX;
- const int player_y = CAST_S32(playerPos.y) - mMidTileY;
+ const int player_x = localPlayer->mPixelX - mMidTileX;
+ const int player_y = localPlayer->mPixelY - mMidTileY;
if (mScrollLaziness < 1)
mScrollLaziness = 1; // Avoids division by zero
@@ -314,12 +313,11 @@ void Viewport::drawDebugPath(Graphics *const graphics)
if (mouseDestination.x != lastMouseDestination.x
|| mouseDestination.y != lastMouseDestination.y)
{
- const Vector &playerPos = localPlayer->getPixelPositionF();
-
debugPath = mMap->findPath(
- CAST_S32(playerPos.x - mapTileSize / 2) / mapTileSize,
- CAST_S32(playerPos.y - mapTileSize) / mapTileSize,
- mousePosX / mapTileSize, mousePosY / mapTileSize,
+ CAST_S32(localPlayer->mPixelX - mapTileSize / 2) / mapTileSize,
+ CAST_S32(localPlayer->mPixelY - mapTileSize) / mapTileSize,
+ mousePosX / mapTileSize,
+ mousePosY / mapTileSize,
localPlayer->getBlockWalkMask(),
500);
lastMouseDestination = mouseDestination;
@@ -983,11 +981,9 @@ void Viewport::moveCameraToActor(const BeingId actorId,
const Actor *const actor = actorManager->findBeing(actorId);
if (!actor)
return;
- const Vector &actorPos = actor->getPixelPositionF();
- const Vector &playerPos = localPlayer->getPixelPositionF();
settings.cameraMode = 1;
- mCameraRelativeX = CAST_S32(actorPos.x - playerPos.x) + x;
- mCameraRelativeY = CAST_S32(actorPos.y - playerPos.y) + y;
+ mCameraRelativeX = actor->mPixelX - localPlayer->mPixelX + x;
+ mCameraRelativeY = actor->mPixelY - localPlayer->mPixelY + y;
updateMidVars();
}
@@ -996,11 +992,9 @@ void Viewport::moveCameraToPosition(const int x, const int y)
if (!localPlayer)
return;
- const Vector &playerPos = localPlayer->getPixelPositionF();
settings.cameraMode = 1;
-
- mCameraRelativeX = x - CAST_S32(playerPos.x);
- mCameraRelativeY = y - CAST_S32(playerPos.y);
+ mCameraRelativeX = x - localPlayer->mPixelX;
+ mCameraRelativeY = y - localPlayer->mPixelY;
updateMidVars();
}