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
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
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
\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
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
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