X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fscroll.c;h=ceee8644a7fcd03b181050fdf85ce34586820f17;hb=26444a1f2a6670976e67509ac92c8420bf9c7fdc;hp=ad26f4b04e5390a2c870e08544986f53afaa93f6;hpb=26fc7489c3a21062310fbf51b9da51f65086075b;p=16.git diff --git a/src/scroll.c b/src/scroll.c index ad26f4b0..ceee8644 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -1,29 +1,11 @@ #include "src/lib/dos_kb.h" #include "src/lib/mapread.h" -//#include "16\lib\x\modex.h" #include "src/lib/wtest/wtest.c" #include "src/lib/planar.c" //====#include "src\lib\ems.c" - + //word far *clock= (word far*) 0x046C; /* 18.2hz clock */ -/*typedef struct { - bitmap_t *data; - word tileHeight; - word tileWidth; - unsigned int rows; - unsigned int cols; -} tiles_t; - - -typedef struct { - byte *data; - tiles_t *tiles; - int width; - int height; -} map_t;*/ - - typedef struct { map_t *map; page_t *page; @@ -70,14 +52,14 @@ void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword //place holder definitions //#define MAPX 200 //#define MAPY 150 -#define TRIGGX 10 -#define TRIGGY 9 +//#define TRIGGX 10 +//#define TRIGGY 9 void main() { size_t oldfreemem=GetFreeSize(); - long emmhandle; + /*long emmhandle; long emsavail; - char teststr[80]; + char teststr[80];*/ word panswitch=0, panq=1, pand=0; //for panning! int i; static word paloffset=0; @@ -90,7 +72,7 @@ void main() { map_view_t mv, mv2, mv3; map_view_t *bg, *spri, *mask;//, *tmp; byte *dpal, *gpal; - byte far *ptr; + byte huge *ptr; byte *mappalptr; actor_t player; //actor_t npc0; @@ -124,9 +106,9 @@ void main() { /* create the map */ //0000 printf("Total used @ before map load: %zu\n", oldfreemem-GetFreeSize()); - fprintf(stderr, "testing~\n"); +//0000 fprintf(stderr, "testing~\n"); loadmap("data/test.map", &map); - fprintf(stderr, "yay map loaded~~\n"); +//0000 fprintf(stderr, "yay map loaded~~\n"); //---- map = allocMap(map.width,map.height); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly //if(isEMS()) printf("%d tesuto\n", coretotalEMS()); //---- initMap(&map); @@ -138,13 +120,13 @@ void main() { ptr = map.data; mappalptr = map.tiles->data->palette; /* data */ -//0000 printf("Total used @ before image loading: %zu\n", oldfreemem-GetFreeSize()); - ptmp = bitmapLoadPcx("data/ptmp.pcx"); // load sprite +//0000 printf("Total used @ before image loading: %zu\n", oldfreemem-GetFreeSize()); + ptmp = bitmapLoadPcx("data/ptmp.pcx"); // load sprite //npctmp = bitmapLoadPcx("ptmp1.pcx"); // load sprite - + /* create the planar buffer */ -//0000 printf("Total used @ before planar buffer creation: %zu\n", oldfreemem-GetFreeSize()); - p = planar_buf_from_bitmap(&ptmp); +//0000 printf("Total used @ before planar buffer creation: %zu\n", oldfreemem-GetFreeSize()); + p = planar_buf_from_bitmap(&ptmp); //0000 printf("Total used @ after planar buffer creation: %zu\n", oldfreemem-GetFreeSize()); /*if(isEMS()) @@ -653,7 +635,8 @@ void main() { printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n"); printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n"); printf("Screen: %dx", screen.width); printf("%d\n", screen.height); - printf("Screen2: %dx", screen2.width); printf("%d\n", screen2.height); + printf("Screen2: %dx", screen2.width); printf("%d\n", screen2.height); + //printf("map.width=%d map.height=%d map.data[0]=%d\n", bg->map->width, bg->map->height, bg->map->data[0]); //xmsfree(&map); //xmsfree(bg); //xmsfree(spri); @@ -869,8 +852,8 @@ mapGoTo(map_view_t *mv, int tx, int ty) { /* draw the tiles */ modexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0); - py=0; - i=mv->ty * mv->map->width + mv->tx; + py=0; + i=mv->ty * mv->map->width + mv->tx; for(ty=mv->ty-1; py < SCREEN_HEIGHT+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) { mapDrawRow(mv, tx-1, ty, py); i+=mv->map->width - tx; @@ -891,7 +874,8 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) { else { rx = (((i-1) % ((t->data->width)/t->tileWidth)) * t->tileWidth); - ry = (((i-1) / ((t->data->height)/t->tileHeight)) * t->tileHeight); + ry = (((i-1) / ((t->data->height)/t->tileHeight)) * t->tileHeight); + printf("i=%d\n", i); //mxPutTile(t->data, x, y, t->tileWidth, t->tileHeight); modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); } @@ -904,7 +888,7 @@ mapDrawRow(map_view_t *mv, int tx, int ty, word y) { int i; /* the position within the map array */ - i=ty * mv->map->width + tx; + i=ty * mv->map->width + tx; for(x=0; xdxThresh && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) { if(i>=0) { /* we are in the map, so copy! */