From: sparky4 Date: Wed, 3 Sep 2014 18:12:58 +0000 (-0500) Subject: modified: 16/modex16/scroll.c X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=923244a5fb111f4fcef0563bd7b3dbc1a132c6c7;p=16.git modified: 16/modex16/scroll.c modified: 16/modex16/scroll.exe --- diff --git a/16/modex16/scroll.c b/16/modex16/scroll.c index 1e74228e..e2a342d4 100644 --- a/16/modex16/scroll.c +++ b/16/modex16/scroll.c @@ -63,11 +63,24 @@ void main() { mapGoTo(&mv, 0, 0); /* scroll all the way to the right */ - for(x=0; x<(80*16-SCREEN_WIDTH); x++) { + /*for(x=0; x<((80)*16-SCREEN_WIDTH); x++) { + mapScrollRight(&mv, 1); + modexShowPage(mv.page); + } + + for(x=0; x<((80+0.50625)*16-SCREEN_WIDTH); x++) { + mapScrollLeft(&mv, 1); + modexShowPage(mv.page); + }*/ + + for(x=0; x<((40)*16-SCREEN_WIDTH); x++) { mapScrollRight(&mv, 1); modexShowPage(mv.page); } - + for(x=0; x<((40/*+0.50625*/)*16-SCREEN_WIDTH); x++) { + mapScrollLeft(&mv, 1); + modexShowPage(mv.page); + } /* spin for a time */ for(x=0; x<500; x++) { @@ -151,7 +164,7 @@ mapScrollRight(map_view_t *mv, byte offset) { /* draw the next column */ x= SCREEN_WIDTH; i= mv->ty * mv->map->width + mv->tx + 20; - for(y=0; y<240; y+=16) { + for(y=0; ymap->tiles, mv->map->data[i], mv->page, (int)mv->page->dx + x, (int)mv->page->dy+y); i += mv->map->width; } @@ -160,7 +173,30 @@ mapScrollRight(map_view_t *mv, byte offset) { void -mapScrollLeft(map_view_t *mv, byte offest) { +mapScrollLeft(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 =16; + + + /* draw the next column */ + x= SCREEN_WIDTH; + i= mv->ty * mv->map->width + mv->tx + 20; + for(y=0; ymap->tiles, mv->map->data[i], mv->page, (int)mv->page->dx + x, (int)mv->page->dy+y); + i += mv->map->width; + } +} } diff --git a/16/modex16/scroll.exe b/16/modex16/scroll.exe index d99e6a23..bfe86fcf 100644 Binary files a/16/modex16/scroll.exe and b/16/modex16/scroll.exe differ