From: Robert Lowe Date: Sat, 6 Sep 2014 23:28:54 +0000 (-0400) Subject: fixed downward scrolling and added upward scrolling X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=f4d3a026cdce044118ca9415a29a12984fdef803;p=16.git fixed downward scrolling and added upward scrolling --- diff --git a/16/modex16/scroll.c b/16/modex16/scroll.c index de8f8f27..bd086732 100644 --- a/16/modex16/scroll.c +++ b/16/modex16/scroll.c @@ -85,6 +85,12 @@ void main() { modexShowPage(mv.page); } + /* scroll all the way up */ + for(; y>0; y--) { + mapScrollUp(&mv, 1); + modexShowPage(mv.page); + } + /* spin for a time */ for(x=0; x<500; x++) { modexWaitBorder(); @@ -194,6 +200,24 @@ mapScrollLeft(map_view_t *mv, byte offset) { void mapScrollUp(map_view_t *mv, byte offset) { + word x, y; /* coordinate for drawing */ + + /* increment the pixel position and update the page */ + mv->page->dy -= offset; + + /* check to see if this changes the tile */ + if(mv->page->dy == 0 ) { + /* go down one tile */ + mv->ty--; + /* Snap the origin downward */ + mv->page->data -= mv->page->width*4; + mv->page->dy = mv->map->tiles->tileHeight; + + + /* draw the next row */ + y= 0; + mapDrawRow(mv, mv->tx-1 , mv->ty-1, y); + } } @@ -209,7 +233,7 @@ mapScrollDown(map_view_t *mv, byte offset) { /* go down one tile */ mv->ty++; /* Snap the origin downward */ - mv->page->data += SCREEN_WIDTH*4; + mv->page->data += mv->page->width*4; mv->page->dy = mv->map->tiles->tileHeight; diff --git a/16/modex16/scroll.exe b/16/modex16/scroll.exe index 0fe85021..26addeed 100755 Binary files a/16/modex16/scroll.exe and b/16/modex16/scroll.exe differ