]> 4ch.mooo.com Git - 16.git/blobdiff - 16/modex16/scroll.c
modified: 16/modex16/scroll.exe
[16.git] / 16 / modex16 / scroll.c
index 1a637919073baf0e9eeeffb2a5fa47947a127b58..4b9ca122c8ada45151e343b9e9d2d608ef7ed4aa 100644 (file)
@@ -39,6 +39,8 @@ void mapScrollUp(map_view_t *mv, byte offset);
 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
+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
 \r
 void main() {\r
     int show1=1;\r
@@ -62,17 +64,9 @@ void main() {
     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
-    for(x=0; x<((80+0.50625)*16-SCREEN_WIDTH); x++) {\r
-       mapScrollLeft(&mv, 1);\r
-       modexShowPage(mv.page);\r
-    }*/
-
+       /* scroll all the way to the right */\r
+\r
     for(x=0; x<((20)*16-SCREEN_WIDTH); x++) {\r
        mapScrollRight(&mv, 1);\r
        modexShowPage(mv.page);\r
@@ -80,7 +74,7 @@ void main() {
     for(x=0; x<((40/*+0.50625*/)*16-SCREEN_WIDTH); x++) {\r
        mapScrollLeft(&mv, 1);\r
        modexShowPage(mv.page);\r
-    }
+    }\r
 \r
     /* spin for a time */\r
     for(x=0; x<500; x++) {\r
@@ -173,7 +167,7 @@ mapScrollRight(map_view_t *mv, byte offset) {
 \r
 \r
 void\r
-mapScrollLeft(map_view_t *mv, byte offset) {
+mapScrollLeft(map_view_t *mv, byte offset) {\r
        word x, y;  /* coordinate for drawing */\r
     unsigned int i;\r
 \r
@@ -195,8 +189,8 @@ mapScrollLeft(map_view_t *mv, byte offset) {
        for(y=0; y<SCREEN_HEIGHT; 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
 \r
@@ -244,3 +238,40 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) {
     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_HEIGHT+2 & 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+2 && 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