#define SWAP(a, b) tmp=a; a=b; b=tmp;\r
void main() {\r
bitmap_t ptmp; // player sprite\r
- int q=0;\r
+ int q=1;\r
page_t screen, screen2;\r
map_t map;\r
map_view_t mv, mv2;\r
{\r
if(bg->tx >= 0 && bg->tx+20 < MAPX && player.tx == bg->tx + 10)\r
{\r
- for(q=0; q<(TILEWH/SPEED); q++)\r
+ for(q=1; q<=(TILEWH/SPEED); q++)\r
{\r
animatePlayer(bg, spri, 1, 1, player.x, player.y, q, &ptmp);\r
mapScrollRight(bg, SPEED);\r
}\r
else if(player.tx < MAPX)\r
{\r
- for(q=0; q<(TILEWH/SPEED); q++)\r
+ for(q=1; q<=(TILEWH/SPEED); q++)\r
{\r
player.x+=SPEED;\r
animatePlayer(bg, spri, 1, 0, player.x, player.y, q, &ptmp);\r
{\r
if(bg->tx > 0 && bg->tx+20 <= MAPX && player.tx == bg->tx + 10)\r
{\r
- for(q=0; q<(TILEWH/SPEED); q++)\r
+ for(q=1; q<=(TILEWH/SPEED); q++)\r
{\r
\r
animatePlayer(bg, spri, 3, 1, player.x, player.y, q, &ptmp);\r
}\r
else if(player.tx > 1)\r
{\r
- for(q=0; q<(TILEWH/SPEED); q++)\r
+ for(q=1; q<=(TILEWH/SPEED); q++)\r
{\r
player.x-=SPEED;\r
animatePlayer(bg, spri, 3, 0, player.x, player.y, q, &ptmp);\r
{\r
if(bg->ty >= 0 && bg->ty+15 < MAPY && player.ty == bg->ty + 8)\r
{\r
- for(q=0; q<(TILEWH/SPEED); q++)\r
+ for(q=1; q<=(TILEWH/SPEED); q++)\r
{\r
animatePlayer(bg, spri, 2, 1, player.x, player.y, q, &ptmp);\r
mapScrollDown(bg, SPEED);\r
}\r
else if(player.ty < MAPY)\r
{\r
- for(q=0; q<(TILEWH/SPEED); q++)\r
+ for(q=1; q<=(TILEWH/SPEED); q++)\r
{\r
player.y+=SPEED;\r
animatePlayer(bg, spri, 2, 0, player.x, player.y, q, &ptmp);\r
{\r
if(bg->ty > 0 && bg->ty+15 <= MAPY && player.ty == bg->ty + 8)\r
{\r
- for(q=0; q<(TILEWH/SPEED); q++)\r
+ for(q=1; q<=(TILEWH/SPEED); q++)\r
{\r
animatePlayer(bg, spri, 0, 1, player.x, player.y, q, &ptmp);\r
mapScrollUp(bg, SPEED);\r
}\r
else if(player.ty > 1)\r
{\r
- for(q=0; q<(TILEWH/SPEED); q++)\r
+ for(q=1; q<=(TILEWH/SPEED); q++)\r
{\r
player.y-=SPEED;\r
animatePlayer(bg, spri, 0, 0, player.x, player.y, q, &ptmp);\r
\r
void\r
animatePlayer(map_view_t *src, map_view_t *dest, short d1, short d2, int x, int y, int ls, bitmap_t *bmp)\r
-{\r
+{
short dire=32*d1;\r
short qq;\r
short lo = ((TILEWH / SPEED) / 3);\r
- short loo = (ls + lo);\r
+ short loo = (ls + lo);
\r
if(d2==0) qq = 0;\r
else qq = ((ls+1)*SPEED);\r
break;\r
}
//TODO: make flexible animation thingy\r
- if(2>ls && ls>=0) { modexCopyPageRegion(dest->page, src->page, x-2, y-4, x-2, y-4, 28, 40);\r
+ if(2>ls && ls>=1) { modexCopyPageRegion(dest->page, src->page, x-2, y-4, x-2, y-4, 28, 40);\r
modexDrawSpriteRegion(dest->page, x, y, 48, dire, 24, 32, bmp); }else\r
- if(4>ls && ls>=2) { modexCopyPageRegion(dest->page, src->page, x-2, y-4, x-2, y-4, 28, 40);\r
+ if(3>ls && ls>=2) { modexCopyPageRegion(dest->page, src->page, x-2, y-4, x-2, y-4, 28, 40);\r
modexDrawSpriteRegion(dest->page, x, y, 24, dire, 24, 32, bmp); }else\r
- if(6>ls && ls>=4) { modexCopyPageRegion(dest->page, src->page, x-2, y-4, x-2, y-4, 28, 40);\r
+ if(4>ls && ls>=3) { modexCopyPageRegion(dest->page, src->page, x-2, y-4, x-2, y-4, 28, 40);\r
modexDrawSpriteRegion(dest->page, x, y, 0, dire, 24, 32, bmp); }else\r
- if(8>ls && ls>=6) { modexCopyPageRegion(dest->page, src->page, x-2, y-4, x-2, y-4, 28, 40);\r
- modexDrawSpriteRegion(dest->page, x, y, 24, dire, 24, 32, bmp); }else ls-=ls;
+ if(5>ls && ls>=4) { modexCopyPageRegion(dest->page, src->page, x-2, y-4, x-2, y-4, 28, 40);\r
+ modexDrawSpriteRegion(dest->page, x, y, 24, dire, 24, 32, bmp); }
modexWaitBorder();\r
}\r