Added a separate constant for each view border direction.

This commit is contained in:
onpon4 2015-02-26 23:28:31 -05:00
parent c404e3611e
commit 02c93d8b52
2 changed files with 14 additions and 14 deletions

View File

@ -313,5 +313,5 @@ static const signed char rate2reload[6] = {15, 15, 13, 11, 9, 7};
const int screenWidth = 800; const int screenWidth = 800;
const int screenHeight = 600; const int screenHeight = 600;
const int xViewBorder = 100;
const int viewBorder = 100; const int yViewBorder = 100;

View File

@ -193,25 +193,25 @@ void doPlayer()
if (engine.done == 0) if (engine.done == 0)
{ {
if (player.x < viewBorder) if (player.x < xViewBorder)
{ {
engine.smx += viewBorder - player.x; engine.smx += xViewBorder - player.x;
player.x = viewBorder; player.x = xViewBorder;
} }
else if (player.x > screen->w - viewBorder) else if (player.x > screen->w - xViewBorder)
{ {
engine.smx += (screen->w - viewBorder) - player.x; engine.smx += (screen->w - xViewBorder) - player.x;
player.x = screen->w - viewBorder; player.x = screen->w - xViewBorder;
} }
if (player.y < viewBorder) if (player.y < yViewBorder)
{ {
engine.smy += viewBorder - player.y; engine.smy += yViewBorder - player.y;
player.y = viewBorder; player.y = yViewBorder;
} }
else if (player.y > screen->h - viewBorder) else if (player.y > screen->h - yViewBorder)
{ {
engine.smy += (screen->h - viewBorder) - player.y; engine.smy += (screen->h - yViewBorder) - player.y;
player.y = screen->h - viewBorder; player.y = screen->h - yViewBorder;
} }
} }