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:
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
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
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
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 <stdio.h>\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 <stdio.h>\r\n\r\nword far* clock= (word far*) 0x046C; /* 18.2hz clock */\r\n\r\nvoid main() {\r\n
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
-FLAGS=-0 -d3\r
-all: test.exe pcxtest.exe test2.exe\r
+FLAGS=-0 \r
+all: test.exe pcxtest.exe test2.exe scroll.exe\r
\r
+scroll.exe: scroll.obj modex16.obj\r
+ wcl $(FLAGS) scroll.obj modex16.obj\r
+scroll.obj: scroll.c\r
+ wcl $(FLAGS) -c scroll.c\r
test.exe: test.obj modex16.obj\r
wcl $(FLAGS) test.obj modex16.obj\r
\r
\r
word far* clock= (word far*) 0x046C; /* 18.2hz clock */\r
\r
-void main() {
- bitmap_t bmp;
- bitmap_t bmp2;\r
+void main() {\r
int i, j;\r
word start, end;\r
page_t page, page2;\r
- float elapsed;\r
byte *pal, *pal2=NULL;\r
\r
- /* load pcx file */\r
- bmp = modexLoadPcx("ed.pcx");
- bmp2 = modexLoadPcx("koishi~.pcx");
- modexPalUpdate(bmp2.palette);
-\r
/* load our palette */\r
modexLoadPalFile("gfx.pal", &pal2);\r
\r
modexClearRegion(&page, 32, 32, SCREEN_WIDTH-32, SCREEN_HEIGHT-32, 42);\r
modexClearRegion(&page, 48, 48, SCREEN_WIDTH-64, SCREEN_HEIGHT-64, 128);\r
modexShowPage(&page);\r
-
- modexDrawSprite(&page, 320, 240, &bmp);
- modexDrawSprite(&page, 32, 32, &bmp2);\r
- //modexDrawBmp(&page, 0, 0, &bmp2);\r
\r
/* fade in */\r
modexFadeOn(1, pal2);\r
-
-modexPalUpdate(bmp2.palette);\r
+\r
\r
start = *clock;\r
- //for(i=0; i<5; i++) {\r
- while (!kbhit()){ /* Wait for a keystroke */\r
+ for(i=0; i<5; i++) {\r
/* go right */\r
for(j=0; j<32; j++) {\r
page.dx++;\r
}\r
}\r
\r
- (void) getch(); /* Clear the keyboard buffer */\r
end = *clock;\r
\r
/* fade back to text mode */\r
-FLAGS=-0 -d3\r
-all: test.exe pcxtest.exe test2.exe\r
+FLAGS=-0 \r
+all: test.exe pcxtest.exe test2.exe scroll.exe\r
\r
+scroll.exe: scroll.obj modex16.obj\r
+ wcl $(FLAGS) scroll.obj modex16.obj\r
+scroll.obj: scroll.c\r
+ wcl $(FLAGS) -c scroll.c\r
test.exe: test.obj modex16.obj\r
wcl $(FLAGS) test.obj modex16.obj\r
\r
--- /dev/null
+#include "modex16.h"\r
+#include <stdio.h>\r
+#include <stdlib.h>\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
+ word rows;\r
+ word cols;\r
+} tiles_t;\r
+\r
+\r
+typedef struct {\r
+ byte *data;\r
+ tiles_t *tiles;\r
+ word width;\r
+ word height;\r
+} map_t;\r
+\r
+\r
+typedef struct {\r
+ map_t *map;\r
+ page_t *page;\r
+ word tx;\r
+ word ty;\r
+} map_view_t;\r
+\r
+\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, byte tx, byte ty);\r
+void mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y);\r
+\r
+void main() {\r
+ int show1=1;\r
+ int tx, ty;\r
+ int x, y;\r
+ page_t screen;\r
+ map_t map;\r
+ map_view_t mv;\r
+ byte *ptr;\r
+ \r
+ /* create the map */\r
+ map = allocMap(80,60);\r
+ initMap(&map);\r
+ mv.map = ↦\r
+\r
+ /* draw the tiles */\r
+ ptr = map.data;\r
+ modexEnter();\r
+ screen = modexDefaultPage();\r
+ screen.width = 352;\r
+ mv.page = &screen;\r
+ mapGoTo(&mv, 0, 0);\r
+\r
+ /* scroll all the way to the right */\r
+ for(x=0; x<(80*16-SCREEN_WIDTH); x++) {\r
+ mapScrollRight(&mv, 1);\r
+ modexShowPage(mv.page);\r
+ }\r
+ \r
+\r
+ /* spin for a time */\r
+ for(x=0; x<500; x++) {\r
+ modexWaitBorder();\r
+ }\r
+\r
+ modexLeave();\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 = 32;\r
+ map->tiles->data->height= 16;\r
+ map->tiles->data->data = malloc(32*16);\r
+ map->tiles->tileHeight = 16;\r
+ map->tiles->tileWidth = 16;\r
+ map->tiles->rows = 1;\r
+ map->tiles->cols = 2;\r
+\r
+ i=0;\r
+ for(y=0; y<16; y++) {\r
+ for(x=0; x<32; x++) {\r
+ if(x<16)\r
+ map->tiles->data->data[i] = 0x00;\r
+ else\r
+ map->tiles->data->data[i] = 0x47;\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
+ unsigned int i;\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 >= 16) {\r
+ /* go forward one tile */\r
+ mv->tx++;\r
+ /* Snap the origin forward */\r
+ mv->page->data += 4;\r
+ mv->page->dx =0;\r
+\r
+\r
+ /* draw the next column */\r
+ x= SCREEN_WIDTH;\r
+ i= mv->ty * mv->map->width + mv->tx + 20;\r
+ for(y=0; y<240; y+=16) {\r
+ mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, (int)mv->page->dx + x, (int)mv->page->dy+y);\r
+ i += mv->map->width;\r
+ }\r
+ }\r
+}\r
+\r
+\r
+void\r
+mapScrollLeft(map_view_t *mv, byte offest) {\r
+}\r
+\r
+\r
+void\r
+mapScrollUp(map_view_t *mv, byte offset) {\r
+}\r
+\r
+\r
+void\r
+mapScrollDown(map_view_t *mv, byte offset) {\r
+}\r
+\r
+\r
+void\r
+mapGoTo(map_view_t *mv, byte tx, byte 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 = 0;\r
+ mv->page->dy = 0;\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; py < SCREEN_HEIGHT && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) {\r
+ px=0;\r
+ for(tx=mv->tx; px < SCREEN_WIDTH+16 && tx < mv->map->width+1; tx++, px+=mv->map->tiles->tileWidth) {\r
+ mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, px, py);\r
+ i++;\r
+ }\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
word far* clock= (word far*) 0x046C; /* 18.2hz clock */\r
\r
-void main() {
- bitmap_t bmp;
- bitmap_t bmp2;\r
+void main() {\r
int i, j;\r
word start, end;\r
page_t page, page2;\r
- float elapsed;\r
byte *pal, *pal2=NULL;\r
\r
- /* load pcx file */\r
- bmp = modexLoadPcx("ed.pcx");
- bmp2 = modexLoadPcx("koishi~.pcx");
- modexPalUpdate(bmp2.palette);
-\r
/* load our palette */\r
modexLoadPalFile("gfx.pal", &pal2);\r
\r
modexClearRegion(&page, 32, 32, SCREEN_WIDTH-32, SCREEN_HEIGHT-32, 42);\r
modexClearRegion(&page, 48, 48, SCREEN_WIDTH-64, SCREEN_HEIGHT-64, 128);\r
modexShowPage(&page);\r
-
- modexDrawSprite(&page, 320, 240, &bmp);
- modexDrawSprite(&page, 32, 32, &bmp2);\r
- //modexDrawBmp(&page, 0, 0, &bmp2);\r
\r
/* fade in */\r
modexFadeOn(1, pal2);\r
-
-modexPalUpdate(bmp2.palette);\r
+\r
\r
start = *clock;\r
- //for(i=0; i<5; i++) {\r
- while (!kbhit()){ /* Wait for a keystroke */\r
+ for(i=0; i<5; i++) {\r
/* go right */\r
for(j=0; j<32; j++) {\r
page.dx++;\r
}\r
}\r
\r
- (void) getch(); /* Clear the keyboard buffer */\r
end = *clock;\r
\r
/* fade back to text mode */\r
void main() {\r
int i;\r
word start;\r
- float t1, t2;\r
page_t page;\r
\r
page=modexDefaultPage();\r
for(i=0; i<500; i++) {\r
modexShowPage(&page);\r
}\r
- t1 = (*clock - start)/18.2;\r
modexLeave();\r
\r
- printf("Time: %f\n", t1);\r
}\r