From: sparky4 Date: Wed, 3 Sep 2014 11:58:33 +0000 (-0500) Subject: modified: 16/MODEX16.ZIP X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=86c102f6f9e168a6c11fdf611ba128c6addd0412;hp=c652700ead888913116701f8eaba7893b237fb3a;p=16.git modified: 16/MODEX16.ZIP modified: 16/Project 16.bfproject modified: 16/modex16/MAKEFILE modified: 16/modex16/PCXTEST.EXE modified: 16/modex16/TEST.C modified: 16/modex16/TEST.EXE modified: 16/modex16/TEST2.EXE modified: 16/modex16/makefile modified: 16/modex16/pcxtest.exe new file: 16/modex16/scroll.c new file: 16/modex16/scroll.exe modified: 16/modex16/test.c new file: 16/modex16/test.exe modified: 16/modex16/test2.c modified: 16/modex16/test2.exe --- diff --git a/16/MODEX16.ZIP b/16/MODEX16.ZIP index c2af47e6..847cf7dc 100644 Binary files a/16/MODEX16.ZIP and b/16/MODEX16.ZIP differ diff --git a/16/Project 16.bfproject b/16/Project 16.bfproject index f80f6827..8f32f009 100644 --- a/16/Project 16.bfproject +++ b/16/Project 16.bfproject @@ -1,7 +1,7 @@ c2e.convert_special: 0 e2c.convert_num: 0 -openfiles: /dos/z/16/16/dos_gfx.cpp:187:0:0: -openfiles: /dos/z/16/16/dos_gfx.h:116:0:0: +openfiles: /dos/z/16/16/dos_gfx.cpp:5935:5677:0: +openfiles: /dos/z/16/16/dos_gfx.h:910:518:0: openfiles: /dos/z/16/16/dos_kb.c:217:0:0: openfiles: /dos/z/16/16/dos_kb.h:161:0:0: openfiles: /dos/z/16/16/lib/lib_com.cpp:2:0:0: @@ -10,12 +10,8 @@ openfiles: /dos/z/16/16/scroll.txt:5256:4537:0: openfiles: /dos/z/16/16/project16.txt:8063:6091:0: openfiles: /dos/z/16/16/16.txt:0:0:0: openfiles: /dos/z/16/16/lib/x/MODEX.H:5511:2798:0: -openfiles: /dos/z/16/16/TEST.C:430:4128:0: -openfiles: /dos/z/16/16/modex16/test.c:354:22:1: -openfiles: /dos/z/16/16/modex16/pcxtest.c:858:576:0: -openfiles: /dos/z/16/16/modex16/test2.c:385:0:0: -openfiles: /dos/z/16/16/modex16/modex16.c:14732:14507:0: -openfiles: /dos/z/16/16/modex16/modex16.h:0:0:0: +openfiles: /dos/z/16/16/TEST.C:430:6112:0: +openfiles: /dos/z/16/16/modex16/scroll.c:2383:1718:1: snr_recursion_level: 0 convertcolumn_horizontally: 0 adv_open_matchname: 0 @@ -30,7 +26,7 @@ c2e.convert_iso: 0 opendir: file:///dos/z/16/16/modex16 wrap_text_default: 0 bookmarks_filename_mode: 1 -ssearch_text: int index +ssearch_text: mapScrollRight snr_casesens: 1 view_blocks: 1 name: project 16 @@ -86,22 +82,19 @@ recent_files: file:///dos/z/16/16/lib/types.h recent_files: file:///dos/z/16/16/modex16/PCXTEST.C recent_files: file:///dos/z/16/16/lib/MODEX16.C recent_files: file:///dos/z/16/16/lib/MODEX16.H -recent_files: file:///dos/z/16/16/modex16/test.c recent_files: file:///dos/z/16/16/dos_gfx.h recent_files: file:///dos/z/16/16/dos_kb.c recent_files: file:///dos/z/16/16/dos_kb.h recent_files: file:///dos/z/16/16/lib/lib_com.cpp -recent_files: file:///dos/z/16/16/lib/lib_com.h recent_files: file:///dos/z/16/16/dos_gfx.cpp -recent_files: file:///dos/z/16/16/scroll.txt recent_files: file:///dos/z/16/16/project16.txt +recent_files: file:///dos/z/16/16/lib/lib_com.h +recent_files: file:///dos/z/16/16/scroll.txt +recent_files: file:///dos/z/16/16/TEST.C recent_files: file:///dos/z/16/16/16.txt recent_files: file:///dos/z/16/16/lib/x/MODEX.H -recent_files: file:///dos/z/16/16/TEST.C -recent_files: file:///dos/z/16/16/modex16/pcxtest.c -recent_files: file:///dos/z/16/16/modex16/test2.c -recent_files: file:///dos/z/16/16/modex16/modex16.h -recent_files: file:///dos/z/16/16/modex16/modex16.c +recent_files: file:///dos/z/16/16/modex16/SCROLL.C +recent_files: file:///dos/z/16/16/modex16/scroll.c snr_replacetype: 0 savedir: file:///dos/z/16/16/modex16 spell_check_default: 1 @@ -113,9 +106,6 @@ snr_escape_chars: 0 htmlbar_view: 0 spell_lang: en ssearch_dotmatchall: 0 -searchlist: sw -searchlist: SW -searchlist: SH searchlist: QUADWH searchlist: pdump searchlist: #include "modex16.h"\r\n#include \r\n\r\nword far* clock= (word far*) 0x046C; /* 18.2hz clock */\r\n\r\nvoid main() {\r\n#include "modex16.h"\r\n#include \r\n\r\nword far* clock= (word far*) 0x046C; /* 18.2hz clock */\r\n\r\nvoid main() {\r\n @@ -128,6 +118,9 @@ searchlist: gq searchlist: SC_INDEX searchlist: draw searchlist: int index +searchlist: map.dat +searchlist: 32 +searchlist: mapScrollRight autocomplete: 1 outputb_show_all_output: 0 bookmarks_show_mode: 0 diff --git a/16/modex16/MAKEFILE b/16/modex16/MAKEFILE index c48885b8..e0a07cc4 100644 --- a/16/modex16/MAKEFILE +++ b/16/modex16/MAKEFILE @@ -1,6 +1,10 @@ -FLAGS=-0 -d3 -all: test.exe pcxtest.exe test2.exe +FLAGS=-0 +all: test.exe pcxtest.exe test2.exe scroll.exe +scroll.exe: scroll.obj modex16.obj + wcl $(FLAGS) scroll.obj modex16.obj +scroll.obj: scroll.c + wcl $(FLAGS) -c scroll.c test.exe: test.obj modex16.obj wcl $(FLAGS) test.obj modex16.obj diff --git a/16/modex16/PCXTEST.EXE b/16/modex16/PCXTEST.EXE index 0c1d9621..4ab5474e 100644 Binary files a/16/modex16/PCXTEST.EXE and b/16/modex16/PCXTEST.EXE differ diff --git a/16/modex16/TEST.C b/16/modex16/TEST.C index 8d000d56..c5b9d7dc 100644 --- a/16/modex16/TEST.C +++ b/16/modex16/TEST.C @@ -3,20 +3,12 @@ word far* clock= (word far*) 0x046C; /* 18.2hz clock */ -void main() { - bitmap_t bmp; - bitmap_t bmp2; +void main() { int i, j; word start, end; page_t page, page2; - float elapsed; byte *pal, *pal2=NULL; - /* load pcx file */ - bmp = modexLoadPcx("ed.pcx"); - bmp2 = modexLoadPcx("koishi~.pcx"); - modexPalUpdate(bmp2.palette); - /* load our palette */ modexLoadPalFile("gfx.pal", &pal2); @@ -42,19 +34,13 @@ void main() { modexClearRegion(&page, 32, 32, SCREEN_WIDTH-32, SCREEN_HEIGHT-32, 42); modexClearRegion(&page, 48, 48, SCREEN_WIDTH-64, SCREEN_HEIGHT-64, 128); modexShowPage(&page); - - modexDrawSprite(&page, 320, 240, &bmp); - modexDrawSprite(&page, 32, 32, &bmp2); - //modexDrawBmp(&page, 0, 0, &bmp2); /* fade in */ modexFadeOn(1, pal2); - -modexPalUpdate(bmp2.palette); + start = *clock; - //for(i=0; i<5; i++) { - while (!kbhit()){ /* Wait for a keystroke */ + for(i=0; i<5; i++) { /* go right */ for(j=0; j<32; j++) { page.dx++; @@ -78,7 +64,6 @@ modexPalUpdate(bmp2.palette); } } - (void) getch(); /* Clear the keyboard buffer */ end = *clock; /* fade back to text mode */ diff --git a/16/modex16/TEST.EXE b/16/modex16/TEST.EXE index 35ed4b95..b0247b18 100644 Binary files a/16/modex16/TEST.EXE and b/16/modex16/TEST.EXE differ diff --git a/16/modex16/TEST2.EXE b/16/modex16/TEST2.EXE index 6732886a..23ca0df0 100644 Binary files a/16/modex16/TEST2.EXE and b/16/modex16/TEST2.EXE differ diff --git a/16/modex16/makefile b/16/modex16/makefile index c48885b8..e0a07cc4 100644 --- a/16/modex16/makefile +++ b/16/modex16/makefile @@ -1,6 +1,10 @@ -FLAGS=-0 -d3 -all: test.exe pcxtest.exe test2.exe +FLAGS=-0 +all: test.exe pcxtest.exe test2.exe scroll.exe +scroll.exe: scroll.obj modex16.obj + wcl $(FLAGS) scroll.obj modex16.obj +scroll.obj: scroll.c + wcl $(FLAGS) -c scroll.c test.exe: test.obj modex16.obj wcl $(FLAGS) test.obj modex16.obj diff --git a/16/modex16/pcxtest.exe b/16/modex16/pcxtest.exe index 0c1d9621..4ab5474e 100644 Binary files a/16/modex16/pcxtest.exe and b/16/modex16/pcxtest.exe differ diff --git a/16/modex16/scroll.c b/16/modex16/scroll.c new file mode 100644 index 00000000..1e74228e --- /dev/null +++ b/16/modex16/scroll.c @@ -0,0 +1,210 @@ +#include "modex16.h" +#include +#include + +word far *clock= (word far*) 0x046C; /* 18.2hz clock */ + +typedef struct { + bitmap_t *data; + word tileHeight; + word tileWidth; + word rows; + word cols; +} tiles_t; + + +typedef struct { + byte *data; + tiles_t *tiles; + word width; + word height; +} map_t; + + +typedef struct { + map_t *map; + page_t *page; + word tx; + word ty; +} map_view_t; + + + + +map_t allocMap(int w, int h); +void initMap(map_t *map); +void mapScrollRight(map_view_t *mv, byte offset); +void mapScrollLeft(map_view_t *mv, byte offest); +void mapScrollUp(map_view_t *mv, byte offset); +void mapScrollDown(map_view_t *mv, byte offset); +void mapGoTo(map_view_t *mv, byte tx, byte ty); +void mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y); + +void main() { + int show1=1; + int tx, ty; + int x, y; + page_t screen; + map_t map; + map_view_t mv; + byte *ptr; + + /* create the map */ + map = allocMap(80,60); + initMap(&map); + mv.map = ↦ + + /* draw the tiles */ + ptr = map.data; + modexEnter(); + screen = modexDefaultPage(); + screen.width = 352; + mv.page = &screen; + mapGoTo(&mv, 0, 0); + + /* scroll all the way to the right */ + for(x=0; x<(80*16-SCREEN_WIDTH); x++) { + mapScrollRight(&mv, 1); + modexShowPage(mv.page); + } + + + /* spin for a time */ + for(x=0; x<500; x++) { + modexWaitBorder(); + } + + modexLeave(); +} + + +map_t +allocMap(int w, int h) { + map_t result; + + result.width =w; + result.height=h; + result.data = malloc(sizeof(byte) * w * h); + + return result; +} + + +void +initMap(map_t *map) { + /* just a place holder to fill out an alternating pattern */ + int x, y; + int i; + int tile = 1; + map->tiles = malloc(sizeof(tiles_t)); + + /* create the tile set */ + map->tiles->data = malloc(sizeof(bitmap_t)); + map->tiles->data->width = 32; + map->tiles->data->height= 16; + map->tiles->data->data = malloc(32*16); + map->tiles->tileHeight = 16; + map->tiles->tileWidth = 16; + map->tiles->rows = 1; + map->tiles->cols = 2; + + i=0; + for(y=0; y<16; y++) { + for(x=0; x<32; x++) { + if(x<16) + map->tiles->data->data[i] = 0x00; + else + map->tiles->data->data[i] = 0x47; + i++; + } + } + + i=0; + for(y=0; yheight; y++) { + for(x=0; xwidth; x++) { + map->data[i] = tile; + tile = tile ? 0 : 1; + i++; + } + tile = tile ? 0 : 1; + } +} + + +void +mapScrollRight(map_view_t *mv, byte offset) { + word x, y; /* coordinate for drawing */ + unsigned int i; + + /* increment the pixel position and update the page */ + mv->page->dx += offset; + + /* check to see if this changes the tile */ + if(mv->page->dx >= 16) { + /* go forward one tile */ + mv->tx++; + /* Snap the origin forward */ + mv->page->data += 4; + mv->page->dx =0; + + + /* draw the next column */ + x= SCREEN_WIDTH; + i= mv->ty * mv->map->width + mv->tx + 20; + for(y=0; y<240; y+=16) { + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, (int)mv->page->dx + x, (int)mv->page->dy+y); + i += mv->map->width; + } + } +} + + +void +mapScrollLeft(map_view_t *mv, byte offest) { +} + + +void +mapScrollUp(map_view_t *mv, byte offset) { +} + + +void +mapScrollDown(map_view_t *mv, byte offset) { +} + + +void +mapGoTo(map_view_t *mv, byte tx, byte ty) { + int px, py; + unsigned int i; + + /* set up the coordinates */ + mv->tx = tx; + mv->ty = ty; + mv->page->dx = 0; + mv->page->dy = 0; + + /* 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; + for(ty=mv->ty; py < SCREEN_HEIGHT && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) { + px=0; + for(tx=mv->tx; px < SCREEN_WIDTH+16 && tx < mv->map->width+1; tx++, px+=mv->map->tiles->tileWidth) { + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, px, py); + i++; + } + i+=mv->map->width - tx; + } +} + + +void +mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) { + word rx; + word ry; + rx = (i % t->cols) * t->tileWidth; + ry = (i / t->cols) * t->tileHeight; + modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, t->data); +} diff --git a/16/modex16/scroll.exe b/16/modex16/scroll.exe new file mode 100644 index 00000000..d99e6a23 Binary files /dev/null and b/16/modex16/scroll.exe differ diff --git a/16/modex16/test.c b/16/modex16/test.c index 8d000d56..c5b9d7dc 100644 --- a/16/modex16/test.c +++ b/16/modex16/test.c @@ -3,20 +3,12 @@ word far* clock= (word far*) 0x046C; /* 18.2hz clock */ -void main() { - bitmap_t bmp; - bitmap_t bmp2; +void main() { int i, j; word start, end; page_t page, page2; - float elapsed; byte *pal, *pal2=NULL; - /* load pcx file */ - bmp = modexLoadPcx("ed.pcx"); - bmp2 = modexLoadPcx("koishi~.pcx"); - modexPalUpdate(bmp2.palette); - /* load our palette */ modexLoadPalFile("gfx.pal", &pal2); @@ -42,19 +34,13 @@ void main() { modexClearRegion(&page, 32, 32, SCREEN_WIDTH-32, SCREEN_HEIGHT-32, 42); modexClearRegion(&page, 48, 48, SCREEN_WIDTH-64, SCREEN_HEIGHT-64, 128); modexShowPage(&page); - - modexDrawSprite(&page, 320, 240, &bmp); - modexDrawSprite(&page, 32, 32, &bmp2); - //modexDrawBmp(&page, 0, 0, &bmp2); /* fade in */ modexFadeOn(1, pal2); - -modexPalUpdate(bmp2.palette); + start = *clock; - //for(i=0; i<5; i++) { - while (!kbhit()){ /* Wait for a keystroke */ + for(i=0; i<5; i++) { /* go right */ for(j=0; j<32; j++) { page.dx++; @@ -78,7 +64,6 @@ modexPalUpdate(bmp2.palette); } } - (void) getch(); /* Clear the keyboard buffer */ end = *clock; /* fade back to text mode */ diff --git a/16/modex16/test.exe b/16/modex16/test.exe new file mode 100644 index 00000000..b0247b18 Binary files /dev/null and b/16/modex16/test.exe differ diff --git a/16/modex16/test2.c b/16/modex16/test2.c index 19f05e09..9118279f 100644 --- a/16/modex16/test2.c +++ b/16/modex16/test2.c @@ -5,7 +5,6 @@ word far* clock= (word far*) 0x046C; /* 18.2hz clock */ void main() { int i; word start; - float t1, t2; page_t page; page=modexDefaultPage(); @@ -15,8 +14,6 @@ void main() { for(i=0; i<500; i++) { modexShowPage(&page); } - t1 = (*clock - start)/18.2; modexLeave(); - printf("Time: %f\n", t1); } diff --git a/16/modex16/test2.exe b/16/modex16/test2.exe index 6732886a..23ca0df0 100644 Binary files a/16/modex16/test2.exe and b/16/modex16/test2.exe differ