void mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y);\r
void mapDrawRow(map_view_t *mv, int tx, int ty, word y);\r
void mapDrawCol(map_view_t *mv, int tx, int ty, word x);\r
-void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */short d1, short d2, int x, int y, int ls, int lp, bitmap_t *bmp);\r
+void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword d, short scrolloffsetswitch, int x, int y, int ls, int lp, bitmap_t *bmp);\r
\r
#define TILEWH 16\r
#define QUADWH (TILEWH/4)\r
//to stop scrolling and have the player position data move to the edge of the screen with respect to the direction\r
//when player.tx or player.ty == 0 or player.tx == 20 or player.ty == 15 then stop because that is edge of map and you do not want to walk of the map\r
#define INC_PER_FRAME if(player.q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1;
-\r
+
+ //right movement\r
if((keyp(77) && !keyp(75) && player.d == 0) || player.d == 2)\r
{
if(player.d == 0){ player.d = 2; }\r
{\r
INC_PER_FRAME;\r
//animatePlayer(bg, spri, mask, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp);\r
- animatePlayer(bg, spri, 1, 1, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+ animatePlayer(bg, spri, player.d-1, 1, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
mapScrollRight(bg, SPEED);\r
mapScrollRight(spri, SPEED);\r
//mapScrollRight(mask, SPEED);\r
INC_PER_FRAME;\r
player.x+=SPEED;\r
//animatePlayer(bg, spri, mask, 1, 0, player.x, player.y, persist_aniframe, q, &ptmp);\r
- animatePlayer(bg, spri, 1, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+ animatePlayer(bg, spri, player.d-1, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
modexShowPage(spri->page);\r
player.q++;\r
} else { player.q = 1; player.d = 0; player.tx++; }\r
}\r
player.triggerx = player.tx+1;\r
player.triggery = player.ty;\r
- }\r
+ }
\r
+ //left movement\r
if((keyp(75) && !keyp(77) && player.d == 0) || player.d == 4)\r
{
if(player.d == 0){ player.d = 4; }\r
{\r
INC_PER_FRAME;\r
//animatePlayer(bg, spri, mask, 3, 1, player.x, player.y, persist_aniframe, q, &ptmp);\r
- animatePlayer(bg, spri, 3, 1, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+ animatePlayer(bg, spri, player.d-1, 1, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
mapScrollLeft(bg, SPEED);\r
mapScrollLeft(spri, SPEED);\r
//mapScrollLeft(mask, SPEED);\r
INC_PER_FRAME;\r
player.x-=SPEED;\r
//animatePlayer(bg, spri, mask, 3, 0, player.x, player.y, persist_aniframe, q, &ptmp);\r
- animatePlayer(bg, spri, 3, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+ animatePlayer(bg, spri, player.d-1, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
modexShowPage(spri->page);\r
player.q++;\r
} else { player.q = 1; player.d = 0; player.tx--; }\r
}\r
player.triggerx = player.tx-1;\r
player.triggery = player.ty;\r
- }\r
+ }
\r
+ //down movement\r
if((keyp(80) && !keyp(72) && player.d == 0) || player.d == 3)\r
{
if(player.d == 0){ player.d = 3; }\r
{\r
INC_PER_FRAME;\r
//animatePlayer(bg, spri, mask, 2, 1, player.x, player.y, persist_aniframe, q, &ptmp);\r
- animatePlayer(bg, spri, 2, 1, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+ animatePlayer(bg, spri, player.d-1, 1, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
mapScrollDown(bg, SPEED);\r
mapScrollDown(spri, SPEED);\r
//mapScrollDown(mask, SPEED);\r
INC_PER_FRAME;\r
player.y+=SPEED;\r
//animatePlayer(bg, spri, mask, 2, 0, player.x, player.y, persist_aniframe, q, &ptmp);\r
- animatePlayer(bg, spri, 2, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+ animatePlayer(bg, spri, player.d-1, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
modexShowPage(spri->page);\r
player.q++;\r
} else { player.q = 1; player.d = 0; player.ty++; }\r
player.triggerx = player.tx;\r
player.triggery = player.ty+1;\r
}\r
-\r
+
+ //up movement\r
if((keyp(72) && !keyp(80) && player.d == 0) || player.d == 1)\r
{
if(player.d == 0){ player.d = 1; }\r
{\r
INC_PER_FRAME;\r
//animatePlayer(bg, spri, mask, 0, 1, player.x, player.y, persist_aniframe, q, &ptmp);\r
- animatePlayer(bg, spri, 0, 1, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+ animatePlayer(bg, spri, player.d-1, 1, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
mapScrollUp(bg, SPEED);\r
mapScrollUp(spri, SPEED);\r
//mapScrollUp(mask, SPEED);\r
player.y-=SPEED;\r
//animatePlayer(bg, spri, mask, 0, 0, player.x, player.y, persist_aniframe, q, &ptmp);\r
modexShowPage(spri->page);\r
- animatePlayer(bg, spri, 0, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+ animatePlayer(bg, spri, player.d-1, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
player.q++;\r
} else { player.q = 1; player.d = 0; player.ty--; }\r
}\r
}\r
\r
void\r
-animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */short d1, short d2, int x, int y, int ls, int lp, bitmap_t *bmp)\r
+animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword d, short scrolloffsetswitch, int x, int y, int ls, int lp, bitmap_t *bmp)\r
{\r
- short dire=32*d1; //direction\r
- short qq; //scroll offset\r
+ sword dire=32*d; //direction\r
+ sword qq; //scroll offset\r
\r
- if(d2==0) qq = 0;\r
+ if(scrolloffsetswitch==0) qq = 0;\r
else qq = ((lp)*SPEED);\r
- switch (d1)\r
+ switch (d)\r
{\r
case 0:\r
//up\r