X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fscroll.c;h=6546d4decfd92894da3b8befc3f6132e027be028;hb=032eb85aa3374bfb48d545b5d093ac84aa68c561;hp=ccbb9d696b3d9e85309ba61ebcfbe6f001c7aa56;hpb=03a770d033676d87f693ff7108415c08a85427b0;p=16.git diff --git a/src/scroll.c b/src/scroll.c index ccbb9d69..6546d4de 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -1,29 +1,11 @@ #include "src/lib/dos_kb.h" -#include "src/lib/mapread.c" -//#include "16\lib\x\modex.h" +#include "src/lib/mapread.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,8 +72,10 @@ void main() { map_view_t mv, mv2, mv3; map_view_t *bg, *spri, *mask;//, *tmp; byte *dpal, *gpal; - byte *ptr, *mappalptr; - actor_t player; + byte *ptr; + byte *mappalptr; + actor_t player; +// bitmap_t font; //actor_t npc0; // atexit(qclean()); @@ -123,9 +107,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); @@ -137,13 +121,14 @@ 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 +// font = bitmapLoadPcx("data/font.pcx"); //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()) @@ -206,8 +191,9 @@ void main() { screen.height += (TILEWH*2)+QUADWH; mv.page = &screen; screen2 = modexNextPage(mv.page); - mv2.page = &screen2; - screen3 = screen2; + mv2.page = &screen2; + screen3 = modexNextPage0(mv2.page, 352, 176); //(352*176)+1024 is the remaining amount of memory left wwww + //screen3 = modexNextPage0(mv2.page, 320, 192); //(352*176)+1024 is the remaining amount of memory left wwww mv3.page = &screen3; /* set up paging */ @@ -547,8 +533,10 @@ void main() { { bg->page->dx++; spri->page->dx++; + mask->page->dx++; modexShowPage(bg->page); modexShowPage(spri->page); + modexShowPage(mask->page); panq++; } else { panq = 1; pand = 0; } } @@ -560,8 +548,10 @@ void main() { { bg->page->dx--; spri->page->dx--; + mask->page->dx--; modexShowPage(bg->page); modexShowPage(spri->page); + modexShowPage(mask->page); panq++; } else { panq = 1; pand = 0; } } @@ -573,8 +563,10 @@ void main() { { bg->page->dy--; spri->page->dy--; + mask->page->dy--; modexShowPage(bg->page); modexShowPage(spri->page); + modexShowPage(mask->page); panq++; } else { panq = 1; pand = 0; } } @@ -586,12 +578,17 @@ void main() { { bg->page->dy++; spri->page->dy++; + mask->page->dy++; modexShowPage(bg->page); - modexShowPage(spri->page); + modexShowPage(spri->page); + modexShowPage(mask->page); panq++; } else { panq = 1; pand = 0; } } -} +} + + //the scripting stuf.... + //if(((player.triggerx == TRIGGX && player.triggery == TRIGGY) && keyp(0x1C))||(player.tx == 5 && player.ty == 5)) if(((bg->map->data[(player.triggerx-1)+(map.width*(player.triggery-1))] == 0) && keyp(0x1C))||(player.tx == 5 && player.ty == 5)) { @@ -602,9 +599,14 @@ void main() { } nosound(); } - if(player.q == (TILEWH/SPEED)+1 && player.d > 0 && (player.triggerx == 5 && player.triggery == 5)){ player.hp--; } - //if(keyp(0x0E)) while(1){ if(xmsmalloc(24)) break; } - if(keyp(25)){ pdump(bg); pdump(spri); } + if(player.q == (TILEWH/SPEED)+1 && player.d > 0 && (player.triggerx == 5 && player.triggery == 5)){ player.hp--; } + //debugging binds! + //if(keyp(0x0E)) while(1){ if(xmsmalloc(24)) break; } + if(keyp(2)) modexShowPage(bg->page); + if(keyp(3)) modexShowPage(spri->page); + if(keyp(4)) modexShowPage(mask->page); + if(keyp(0x44)){ bputs(spri->page, player.x+(TILEWH*2), player.y+(TILEWH*2), "wwww"); } //f10 + if(keyp(25)){ pdump(bg); pdump(spri); } //p if(keyp(24)){ modexPalUpdate0(gpal); paloffset=0; pdump(bg); pdump(spri); } if(keyp(22)){ paloffset=0; modexPalBlack(); modexPalUpdate(&ptmp, &paloffset, 0, 0); @@ -612,9 +614,10 @@ void main() { modexPalUpdate(map.tiles->data, &paloffset, 0, 0); printf("2paloffset = %d\n", paloffset/3); pdump(bg); pdump(spri); } - - if(keyp(88)){if(!panswitch) panswitch++; else panswitch--; } - if(keyp(87)) + //pan switch + if(keyp(88)){if(!panswitch) panswitch++; else panswitch--; } //f12 + //TSR + if(keyp(87)) //f11 { modexLeave(); setkb(0); @@ -652,13 +655,16 @@ 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); //xmsfree(mask); //xmsreport(); - //emmclose(emmhandle); + //emmclose(emmhandle); + printf("%Fp\n", bios_8x8_font()); + //printf("%c\n", *bios_8x8_font()); switch(detectcpu()) { case 0: cpus = "8086/8088 or 186/88"; break; @@ -868,8 +874,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; @@ -890,7 +896,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); +////0000 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)); } @@ -903,7 +910,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! */