]> 4ch.mooo.com Git - 16.git/commitdiff
p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I...
authorsparky4 <sparky4@cock.li>
Mon, 10 Apr 2017 16:58:42 +0000 (11:58 -0500)
committersparky4 <sparky4@cock.li>
Mon, 10 Apr 2017 16:58:42 +0000 (11:58 -0500)
src/1croll.c [new file with mode: 0755]
src/lib/16_spri.h

diff --git a/src/1croll.c b/src/1croll.c
new file mode 100755 (executable)
index 0000000..4886880
--- /dev/null
@@ -0,0 +1,615 @@
+#include "src\lib\modex16.h"\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include "src\lib\dos_kb.h"\r
+#include "src\lib\wtest\wtest.c"\r
+\r
+//word far *clock= (word far*) 0x046C; /* 18.2hz clock */\r
+\r
+typedef struct {\r
+       bitmap_t *data;\r
+       word tileHeight;\r
+       word tileWidth;\r
+       unsigned int rows;\r
+       unsigned int cols;\r
+} tiles_t;\r
+\r
+\r
+typedef struct {\r
+       byte    *data;\r
+       tiles_t *tiles;\r
+       int width;\r
+       int height;\r
+} map_t;\r
+\r
+\r
+typedef struct {\r
+       map_t *map;\r
+       page_t *page;\r
+       int tx; //appears to be the top left tile position on the viewable screen map\r
+       int ty; //appears to be the top left tile position on the viewable screen map\r
+       word dxThresh; //????\r
+       word dyThresh; //????\r
+} map_view_t;\r
+\r
+//TODO: make this into actor_t\r
+struct {\r
+       int x; //player exact position on the viewable map\r
+       int y; //player exact position on the viewable map\r
+       int tx; //player tile position on the viewable map\r
+       int ty; //player tile position on the viewable map\r
+       int triggerx; //player's trigger box tile position on the viewable map\r
+       int triggery; //player's trigger box tile position on the viewable map\r
+       int hp; //hitpoints of the player\r
+} player;\r
+\r
+\r
+map_t allocMap(int w, int h);\r
+void initMap(map_t *map);\r
+void mapScrollRight(map_view_t *mv, byte offset);\r
+void mapScrollLeft(map_view_t *mv, byte offest);\r
+void mapScrollUp(map_view_t *mv, byte offset);\r
+void mapScrollDown(map_view_t *mv, byte offset);\r
+void mapGoTo(map_view_t *mv, int tx, int ty);\r
+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
+\r
+#define TILEWH 16\r
+#define QUADWH (TILEWH/4)\r
+#define SPEED 4\r
+\r
+//place holder definitions\r
+#define MAPX 200\r
+#define MAPY 150\r
+#define TRIGGX 10\r
+#define TRIGGY 9\r
+//#define SWAP(a, b) tmp=a; a=b; b=tmp;\r
+void main() {\r
+       bitmap_t ptmp; // player sprite\r
+       word q=1;\r
+       const char *cpus;\r
+       static int persist_aniframe = 0;    /* gonna be increased to 1 before being used, so 0 is ok for default */\r
+       page_t screen, screen2, screen3;\r
+       map_t map;\r
+       map_view_t mv, mv2, mv3;\r
+       map_view_t *bg, *spri, *mask;//, *tmp;\r
+       byte *ptr;\r
+\r
+       /* create the map */\r
+       map = allocMap(MAPX,MAPY); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly\r
+       initMap(&map);\r
+       mv.map = &map;\r
+       mv2.map = &map;\r
+       mv3.map = &map;\r
+\r
+       /* draw the tiles */\r
+       ptr = map.data;\r
+       /*data\\*/\r
+       ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite\r
+       setkb(1);\r
+       modexEnter();\r
+       modexPalUpdate(ptmp.palette);\r
+       screen = modexDefaultPage();\r
+       screen.width += (TILEWH*2);\r
+       screen.height += (TILEWH*2)+QUADWH;\r
+       mv.page = &screen;\r
+       screen2 = modexNextPage(mv.page);\r
+       mv2.page = &screen2;\r
+       screen3 = screen2;\r
+       mv3.page = &screen3;\r
+\r
+       /* set up paging */\r
+       bg = &mv;\r
+       spri = &mv2;\r
+       mask = &mv3;\r
+\r
+//TODO: LOAD map data and position the map in the middle of the screen if smaller then screen\r
+       mapGoTo(bg, 0, 0);\r
+       mapGoTo(spri, 0, 0);\r
+       //mapGoTo(mask, 0, 0);\r
+\r
+       //TODO: put player in starting position of spot\r
+       //default player position on the viewable map\r
+       player.tx = bg->tx + 10;\r
+       player.ty = bg->ty + 8;\r
+       player.x = player.tx*TILEWH;\r
+       player.y = player.ty*TILEWH;\r
+       player.triggerx = player.tx;\r
+       player.triggery = player.ty+1;\r
+       //TODO: erase player initial draw\r
+       modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp);\r
+       //temp draw trigger box\r
+       modexClearRegion(spri->page, player.triggerx*16, player.triggery*16, 16, 16, 1);\r
+       modexClearRegion(bg->page, player.triggerx*16, player.triggery*16, 16, 16, 1);\r
+       modexShowPage(spri->page);\r
+       while(!keyp(1))//!keyp(1))\r
+       {\r
+       //top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square\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
+\r
+       #define INC_PER_FRAME if(q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1;\r
+\r
+       //temp testing\r
+               /*if(bg->tx >= 0 && bg->tx+20 < MAPX && player.tx == bg->tx + 10)\r
+               {\r
+                       for(q=1; q<=(TILEWH/SPEED); q++)\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, q, &ptmp);\r
+                               mapScrollRight(bg, SPEED);\r
+                               //mapScrollRight(spri, SPEED);\r
+                               //mapScrollRight(mask, SPEED);\r
+                               modexShowPage(bg->page);\r
+                       }\r
+                       player.tx++;\r
+               }\r
+               else if(player.tx < MAPX)\r
+               {\r
+                       for(q=1; q<=(TILEWH/SPEED); q++)\r
+                       {\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, q, &ptmp);\r
+                               modexShowPage(spri->page);\r
+                       }\r
+                       player.tx++;\r
+               }\r
+               else\r
+               {\r
+break;\r
+               }*/\r
+       if(keyp(77) && !keyp(75))\r
+       {\r
+               if(bg->tx >= 0 && bg->tx+20 < MAPX && player.tx == bg->tx + 10 && !(player.tx+1 == TRIGGX && player.ty == TRIGGY))\r
+               {\r
+                       for(q=1; q<=(TILEWH/SPEED); q++)\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, q, &ptmp);\r
+                               mapScrollRight(bg, SPEED);\r
+                               mapScrollRight(spri, SPEED);\r
+                               //mapScrollRight(mask, SPEED);\r
+                               modexShowPage(spri->page);\r
+                       }\r
+                       player.tx++;\r
+               }\r
+               else if(player.tx < MAPX && !(player.tx+1 == TRIGGX && player.ty == TRIGGY))\r
+               {\r
+                       for(q=1; q<=(TILEWH/SPEED); q++)\r
+                       {\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, q, &ptmp);\r
+                               modexShowPage(spri->page);\r
+                       }\r
+                       player.tx++;\r
+               }\r
+               else\r
+               {\r
+                       modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32);\r
+                       modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 32, 24, 32, &ptmp);\r
+                       modexShowPage(spri->page);\r
+               }\r
+               player.triggerx = player.tx+1;\r
+               player.triggery = player.ty;\r
+       }\r
+\r
+       if(keyp(75) && !keyp(77))\r
+       {\r
+               if(bg->tx > 0 && bg->tx+20 <= MAPX && player.tx == bg->tx + 10 && !(player.tx-1 == TRIGGX && player.ty == TRIGGY))\r
+               {\r
+                       for(q=1; q<=(TILEWH/SPEED); q++)\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, q, &ptmp);\r
+                               mapScrollLeft(bg, SPEED);\r
+                               mapScrollLeft(spri, SPEED);\r
+                               //mapScrollLeft(mask, SPEED);\r
+                               modexShowPage(spri->page);\r
+                       }\r
+                       player.tx--;\r
+               }\r
+               else if(player.tx > 1 && !(player.tx-1 == TRIGGX && player.ty == TRIGGY))\r
+               {\r
+                       for(q=1; q<=(TILEWH/SPEED); q++)\r
+                       {\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, q, &ptmp);\r
+                               modexShowPage(spri->page);\r
+                       }\r
+                       player.tx--;\r
+               }\r
+               else\r
+               {\r
+                       modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32);\r
+                       modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 96, 24, 32, &ptmp);\r
+                       modexShowPage(spri->page);\r
+               }\r
+               player.triggerx = player.tx-1;\r
+               player.triggery = player.ty;\r
+       }\r
+\r
+       if(keyp(80) && !keyp(72))\r
+       {\r
+               if(bg->ty >= 0 && bg->ty+15 < MAPY && player.ty == bg->ty + 8 && !(player.tx == TRIGGX && player.ty+1 == TRIGGY))\r
+               {\r
+                       for(q=1; q<=(TILEWH/SPEED); q++)\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, q, &ptmp);\r
+                               mapScrollDown(bg, SPEED);\r
+                               mapScrollDown(spri, SPEED);\r
+                               //mapScrollDown(mask, SPEED);\r
+                               modexShowPage(spri->page);\r
+                       }\r
+                       player.ty++;\r
+               }\r
+               else if(player.ty < MAPY && !(player.tx == TRIGGX && player.ty+1 == TRIGGY))\r
+               {\r
+                       for(q=1; q<=(TILEWH/SPEED); q++)\r
+                       {\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, q, &ptmp);\r
+                               modexShowPage(spri->page);\r
+                       }\r
+                       player.ty++;\r
+               }\r
+               else\r
+               {\r
+                       modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32);\r
+                       modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp);\r
+                       modexShowPage(spri->page);\r
+               }\r
+               player.triggerx = player.tx;\r
+               player.triggery = player.ty+1;\r
+       }\r
+\r
+       if(keyp(72) && !keyp(80))\r
+       {\r
+               if(bg->ty > 0 && bg->ty+15 <= MAPY && player.ty == bg->ty + 8 && !(player.tx == TRIGGX && player.ty-1 == TRIGGY))\r
+               {\r
+                       for(q=1; q<=(TILEWH/SPEED); q++)\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, q, &ptmp);\r
+                               mapScrollUp(bg, SPEED);\r
+                               mapScrollUp(spri, SPEED);\r
+                               //mapScrollUp(mask, SPEED);\r
+                               modexShowPage(spri->page);\r
+                       }\r
+                       player.ty--;\r
+               }\r
+               else if(player.ty > 1 && !(player.tx == TRIGGX &&  player.ty-1 == TRIGGY))\r
+               {\r
+                       for(q=1; q<=(TILEWH/SPEED); q++)\r
+                       {\r
+                               INC_PER_FRAME;\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, q, &ptmp);\r
+                       }\r
+                       player.ty--;\r
+               }\r
+               else\r
+               {\r
+                       modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32);\r
+                       modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 0, 24, 32, &ptmp);\r
+                       modexShowPage(spri->page);\r
+               }\r
+               player.triggerx = player.tx;\r
+               player.triggery = player.ty-1;\r
+       }\r
+       //modexClearRegion(mask->page, 66, 66, 2, 40, 0);\r
+\r
+       if((player.triggerx == TRIGGX && player.triggery == TRIGGY) && keyp(KEY_ENTER))\r
+       {\r
+               short i;\r
+               for(i=600; i>=400; i--)\r
+               {\r
+                       sound(i);\r
+               }\r
+               nosound();\r
+       }\r
+       }\r
+\r
+       modexLeave();\r
+       setkb(0);\r
+       printf("Project 16 scroll.exe\n");\r
+       printf("tx: %d\n", bg->tx);\r
+       printf("ty: %d\n", bg->ty);\r
+       printf("player.x: %d\n", player.x);\r
+       printf("player.y: %d\n", player.y);\r
+       printf("player.tx: %d\n", player.tx);\r
+       printf("player.ty: %d\n", player.ty);\r
+       printf("player.triggx: %d\n", player.triggerx);\r
+       printf("player.triggy: %d\n", player.triggery);\r
+       printf("dxThresh: %d\n", bg->dxThresh);\r
+       printf("dyThresh: %d\n", bg->dyThresh);\r
+       printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n");\r
+       printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n");\r
+       printf("\n");\r
+       switch(detectcpu())\r
+       {\r
+               case 0: cpus = "8086/8088 or 186/88"; break;\r
+               case 1: cpus = "286"; break;\r
+               case 2: cpus = "386 or newer"; break;\r
+               default: cpus = "internal error"; break;\r
+       }\r
+       printf("detected CPU type: %s\n", cpus);\r
+}\r
+\r
+\r
+map_t\r
+allocMap(int w, int h) {\r
+       map_t result;\r
+\r
+       result.width =w;\r
+       result.height=h;\r
+       result.data = malloc(sizeof(byte) * w * h);\r
+\r
+       return result;\r
+}\r
+\r
+\r
+void\r
+initMap(map_t *map) {\r
+       /* just a place holder to fill out an alternating pattern */\r
+       int x, y;\r
+       int i;\r
+       int tile = 1;\r
+       map->tiles = malloc(sizeof(tiles_t));\r
+\r
+       /* create the tile set */\r
+       map->tiles->data = malloc(sizeof(bitmap_t));\r
+       map->tiles->data->width = (TILEWH*2);\r
+       map->tiles->data->height= TILEWH;\r
+       map->tiles->data->data = malloc((TILEWH*2)*TILEWH);\r
+       map->tiles->tileHeight = TILEWH;\r
+       map->tiles->tileWidth =TILEWH;\r
+       map->tiles->rows = 1;\r
+       map->tiles->cols = 2;\r
+\r
+       i=0;\r
+       for(y=0; y<TILEWH; y++) {\r
+       for(x=0; x<(TILEWH*2); x++) {\r
+               if(x<TILEWH)\r
+                 map->tiles->data->data[i] = 28;//0x24;\r
+               else\r
+                 map->tiles->data->data[i] = 0;//0x34;\r
+               i++;\r
+       }\r
+       }\r
+\r
+       i=0;\r
+       for(y=0; y<map->height; y++) {\r
+               for(x=0; x<map->width; x++) {\r
+                       map->data[i] = tile;\r
+                       tile = tile ? 0 : 1;\r
+                       i++;\r
+               }\r
+               tile = tile ? 0 : 1;\r
+       }\r
+}\r
+\r
+\r
+void\r
+mapScrollRight(map_view_t *mv, byte offset) {\r
+       word x, y;  /* coordinate for drawing */\r
+\r
+       /* increment the pixel position and update the page */\r
+       mv->page->dx += offset;\r
+\r
+       /* check to see if this changes the tile */\r
+       if(mv->page->dx >= mv->dxThresh ) {\r
+       /* go forward one tile */\r
+       mv->tx++;\r
+       /* Snap the origin forward */\r
+       mv->page->data += 4;\r
+       mv->page->dx = mv->map->tiles->tileWidth;\r
+\r
+\r
+       /* draw the next column */\r
+       x= SCREEN_WIDTH + mv->map->tiles->tileWidth;\r
+               mapDrawCol(mv, mv->tx + 20 , mv->ty-1, x);\r
+       }\r
+}\r
+\r
+\r
+void\r
+mapScrollLeft(map_view_t *mv, byte offset) {\r
+       word x, y;  /* coordinate for drawing */\r
+\r
+       /* increment the pixel position and update the page */\r
+       mv->page->dx -= offset;\r
+\r
+       /* check to see if this changes the tile */\r
+       if(mv->page->dx == 0) {\r
+       /* go backward one tile */\r
+       mv->tx--;\r
+\r
+       /* Snap the origin backward */\r
+       mv->page->data -= 4;\r
+       mv->page->dx = mv->map->tiles->tileWidth;\r
+\r
+       /* draw the next column */\r
+               mapDrawCol(mv, mv->tx-1, mv->ty-1, 0);\r
+       }\r
+}\r
+\r
+\r
+void\r
+mapScrollUp(map_view_t *mv, byte offset) {\r
+       word x, y;  /* coordinate for drawing */\r
+\r
+       /* increment the pixel position and update the page */\r
+       mv->page->dy -= offset;\r
+\r
+       /* check to see if this changes the tile */\r
+       if(mv->page->dy == 0 ) {\r
+       /* go down one tile */\r
+       mv->ty--;\r
+       /* Snap the origin downward */\r
+       mv->page->data -= mv->page->width*4;\r
+       mv->page->dy = mv->map->tiles->tileHeight;\r
+\r
+\r
+       /* draw the next row */\r
+       y= 0;\r
+               mapDrawRow(mv, mv->tx-1 , mv->ty-1, y);\r
+       }\r
+}\r
+\r
+\r
+void\r
+mapScrollDown(map_view_t *mv, byte offset) {\r
+       word x, y;  /* coordinate for drawing */\r
+\r
+       /* increment the pixel position and update the page */\r
+       mv->page->dy += offset;\r
+\r
+       /* check to see if this changes the tile */\r
+       if(mv->page->dy >= mv->dyThresh ) {\r
+       /* go down one tile */\r
+       mv->ty++;\r
+       /* Snap the origin downward */\r
+       mv->page->data += mv->page->width*4;\r
+       mv->page->dy = mv->map->tiles->tileHeight;\r
+\r
+\r
+       /* draw the next row */\r
+       y= SCREEN_HEIGHT + mv->map->tiles->tileHeight;\r
+               mapDrawRow(mv, mv->tx-1 , mv->ty+15, y);\r
+       }\r
+\r
+}\r
+\r
+\r
+void\r
+mapGoTo(map_view_t *mv, int tx, int ty) {\r
+       int px, py;\r
+       unsigned int i;\r
+\r
+       /* set up the coordinates */\r
+       mv->tx = tx;\r
+       mv->ty = ty;\r
+       mv->page->dx = mv->map->tiles->tileWidth;\r
+       mv->page->dy = mv->map->tiles->tileHeight;\r
+\r
+       /* set up the thresholds */\r
+       mv->dxThresh = mv->map->tiles->tileWidth * 2;\r
+       mv->dyThresh = mv->map->tiles->tileHeight * 2;\r
+\r
+       /* draw the tiles */\r
+       modexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0);\r
+       py=0;\r
+       i=mv->ty * mv->map->width + mv->tx;\r
+       for(ty=mv->ty-1; py < SCREEN_HEIGHT+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) {\r
+               mapDrawRow(mv, tx-1, ty, py);\r
+       i+=mv->map->width - tx;\r
+       }\r
+}\r
+\r
+\r
+void\r
+mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) {\r
+       word rx;\r
+       word ry;\r
+       rx = (i % t->cols) * t->tileWidth;\r
+       ry = (i / t->cols) * t->tileHeight;\r
+       modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, t->data);\r
+}\r
+\r
+\r
+void\r
+mapDrawRow(map_view_t *mv, int tx, int ty, word y) {\r
+       word x;\r
+       int i;\r
+\r
+       /* the position within the map array */\r
+       i=ty * mv->map->width + tx;\r
+       for(x=0; x<SCREEN_WIDTH+mv->dxThresh && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) {\r
+       if(i>=0) {\r
+               /* we are in the map, so copy! */\r
+               mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);\r
+       }\r
+       i++; /* next! */\r
+       }\r
+}\r
+\r
+\r
+void\r
+mapDrawCol(map_view_t *mv, int tx, int ty, word x) {\r
+       int y;\r
+       int i;\r
+\r
+       /* location in the map array */\r
+       i=ty * mv->map->width + tx;\r
+\r
+       /* We'll copy all of the columns in the screen,\r
+          i + 1 row above and one below */\r
+       for(y=0; y<SCREEN_HEIGHT+mv->dyThresh && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) {\r
+       if(i>=0) {\r
+               /* we are in the map, so copy away! */\r
+               mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);\r
+       }\r
+       i += mv->map->width;\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
+{\r
+       short dire=32*d1; //direction\r
+       short qq; //scroll offset\r
+\r
+       if(d2==0) qq = 0;\r
+       else qq = ((lp)*SPEED);\r
+       switch (d1)\r
+       {\r
+               case 0:\r
+                       //up\r
+                       x=x-4;\r
+                       y=y-qq-TILEWH;\r
+               break;\r
+               case 1:\r
+                       // right\r
+                       x=x+qq-4;\r
+                       y=y-TILEWH;\r
+               break;\r
+               case 2:\r
+                       //down\r
+                       x=x-4;\r
+                       y=y+qq-TILEWH;\r
+               break;\r
+               case 3:\r
+                       //left\r
+                       x=x-qq-4;\r
+                       y=y-TILEWH;\r
+               break;\r
+       }\r
+       modexCopyPageRegion(dest->page, src->page, x-4, y-4, x-4, y-4, 28, 40);\r
+       if(2>ls && ls>=1) { modexDrawSpriteRegion(dest->page, x, y, 48, dire, 24, 32, bmp); }else\r
+       if(3>ls && ls>=2) { modexDrawSpriteRegion(dest->page, x, y, 24, dire, 24, 32, bmp); }else\r
+       if(4>ls && ls>=3) { modexDrawSpriteRegion(dest->page, x, y, 0, dire, 24, 32, bmp); }else\r
+       if(5>ls && ls>=4) { modexDrawSpriteRegion(dest->page, x, y, 24, dire, 24, 32, bmp); }\r
+       //TODO: mask copy //modexCopyPageRegion(dest->page, src->page, x-4, y-4, x-4, y-4, 28, 40);\r
+       //modexClearRegion(top->page, 66, 66, 2, 40, 0);\r
+       //modexCopyPageRegion(dest->page, top->page, 66, 66, 66, 66, 2, 40);\r
+       //turn this off if XT\r
+       if(detectcpu() > 0) modexWaitBorder();\r
+}\r
index 0e29ebebc4a78778aedd12e9fbf49881077d380a..bb633d279f8d0a17d21672dd1900ad5ee2e10213 100755 (executable)
@@ -23,7 +23,9 @@
 #define __16_SPRI__\r
 \r
 #include "src/lib/16_vrs.h"\r
+#ifndef OLDOLDOLDOLDSCROLLEXE\r
 #include "src/lib/scroll16.h"\r
+#endif\r
 \r
 //moved to 16_tdef.h\r
 // struct sprite\r