Added a separate constant for each view border direction.
This commit is contained in:
parent
c404e3611e
commit
02c93d8b52
|
@ -313,5 +313,5 @@ static const signed char rate2reload[6] = {15, 15, 13, 11, 9, 7};
|
|||
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 600;
|
||||
|
||||
const int viewBorder = 100;
|
||||
const int xViewBorder = 100;
|
||||
const int yViewBorder = 100;
|
||||
|
|
|
@ -193,25 +193,25 @@ void doPlayer()
|
|||
|
||||
if (engine.done == 0)
|
||||
{
|
||||
if (player.x < viewBorder)
|
||||
if (player.x < xViewBorder)
|
||||
{
|
||||
engine.smx += viewBorder - player.x;
|
||||
player.x = viewBorder;
|
||||
engine.smx += xViewBorder - player.x;
|
||||
player.x = xViewBorder;
|
||||
}
|
||||
else if (player.x > screen->w - viewBorder)
|
||||
else if (player.x > screen->w - xViewBorder)
|
||||
{
|
||||
engine.smx += (screen->w - viewBorder) - player.x;
|
||||
player.x = screen->w - viewBorder;
|
||||
engine.smx += (screen->w - xViewBorder) - player.x;
|
||||
player.x = screen->w - xViewBorder;
|
||||
}
|
||||
if (player.y < viewBorder)
|
||||
if (player.y < yViewBorder)
|
||||
{
|
||||
engine.smy += viewBorder - player.y;
|
||||
player.y = viewBorder;
|
||||
engine.smy += yViewBorder - player.y;
|
||||
player.y = yViewBorder;
|
||||
}
|
||||
else if (player.y > screen->h - viewBorder)
|
||||
else if (player.y > screen->h - yViewBorder)
|
||||
{
|
||||
engine.smy += (screen->h - viewBorder) - player.y;
|
||||
player.y = screen->h - viewBorder;
|
||||
engine.smy += (screen->h - yViewBorder) - player.y;
|
||||
player.y = screen->h - yViewBorder;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue