[planetblupi] 46/61: Use a method for fixing the decor shifting
Didier Raboud
odyx at moszumanska.debian.org
Thu Nov 2 19:24:59 UTC 2017
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository planetblupi.
commit 481f4db4b4c8b0e02452ad96fea02bd7aa8825b2
Author: Mathieu Schroeter <mathieu at schroetersa.ch>
Date: Mon Oct 30 17:37:59 2017 +0100
Use a method for fixing the decor shifting
It will be used for supporting the smooth scrolling.
---
src/decor.cxx | 42 ++++++++++++++++++++++++------------------
src/decor.h | 1 +
2 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/src/decor.cxx b/src/decor.cxx
index 8b41db7..f4e65c0 100644
--- a/src/decor.cxx
+++ b/src/decor.cxx
@@ -449,6 +449,29 @@ CDecor::SetFire (Point cel, bool bFire)
return true;
}
+void
+CDecor::FixShifting (Sint32 & nbx, Sint32 & nby, Point & iCel, Point & iPos)
+{
+ if (m_shiftOffset.x < 0) // décalage à droite ?
+ nbx += 2;
+ if (m_shiftOffset.y < 0) // décalage en bas ?
+ nby += 2;
+ if (m_shiftOffset.x > 0) // décalage à gauche ?
+ {
+ nbx += 2;
+ iCel.x--;
+ iCel.y++;
+ iPos = ConvCelToPos (iCel);
+ }
+ if (m_shiftOffset.y > 0) // décalage en haut ?
+ {
+ nby += 2;
+ iCel.x--;
+ iCel.y--;
+ iPos = ConvCelToPos (iCel);
+ }
+}
+
// Modifie l'offset pour le shift.
void
@@ -1435,24 +1458,7 @@ CDecor::Build (Rect clip, Point posMouse)
if (!m_bFog)
goto term;
- if (m_shiftOffset.x < 0) // décalage à droite ?
- nbx += 2;
- if (m_shiftOffset.y < 0) // décalage en bas ?
- nby += 2;
- if (m_shiftOffset.x > 0) // décalage à gauche ?
- {
- nbx += 2;
- iCel.x--;
- iCel.y++;
- iPos = ConvCelToPos (iCel);
- }
- if (m_shiftOffset.y > 0) // décalage en haut ?
- {
- nby += 2;
- iCel.x--;
- iCel.y--;
- iPos = ConvCelToPos (iCel);
- }
+ this->FixShifting (nbx, nby, iCel, iPos);
mCel = iCel;
mPos = iPos;
diff --git a/src/decor.h b/src/decor.h
index 01e4ec4..c53610a 100644
--- a/src/decor.h
+++ b/src/decor.h
@@ -381,6 +381,7 @@ public:
bool IsCheminFree (Sint32 rank, Point dest, Sint32 button);
// Decor.cpp
+ void FixShifting (Sint32 & nbx, Sint32 & nby, Point & iCel, Point & iPos);
void SetShiftOffset (Point offset);
Point ConvCelToPos (Point cel);
Point ConvPosToCel (Point pos, bool bMap = false);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/planetblupi.git
More information about the Pkg-games-commits
mailing list