mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Use a method for fixing the decor shifting
It will be used for supporting the smooth scrolling.
This commit is contained in:
parent
6e7947b7be
commit
481f4db4b4
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user