OSDN Git Service

modified: Project 16.bfproject
[proj16/16.git] / src / scroll.c
index 99cf8e6..6533b67 100644 (file)
@@ -46,16 +46,14 @@ struct {
 
 map_t allocMap(int w, int h);
 void initMap(map_t *map);
-void mapScrollRight(map_view_t *mv, byte offset, short lp);
-void mapScrollLeft(map_view_t *mv, byte offest, short lp);
-void mapScrollUp(map_view_t *mv, byte offset, short lp);
-void mapScrollDown(map_view_t *mv, byte offset, short lp);
+void mapScrollRight(map_view_t *mv, byte offset);
+void mapScrollLeft(map_view_t *mv, byte offest);
+void mapScrollUp(map_view_t *mv, byte offset);
+void mapScrollDown(map_view_t *mv, byte offset);
 void mapGoTo(map_view_t *mv, int tx, int ty);
 void mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y);
-void mapDrawRow(map_view_t *mv, int tx, int ty, word y, word poopoffset);
-void mapDrawCol(map_view_t *mv, int tx, int ty, word x, word poopoffset);
-void mapDrawWRow(map_view_t *mv, int tx, int ty, word y);
-void mapDrawWCol(map_view_t *mv, int tx, int ty, word x);
+void mapDrawRow(map_view_t *mv, int tx, int ty, word y);
+void mapDrawCol(map_view_t *mv, int tx, int ty, word x);
 void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */short d1, short d2, int x, int y, int ls, int lp, bitmap_t *bmp);
 
 #define TILEWH 16
@@ -134,37 +132,6 @@ void main() {
 
        #define INC_PER_FRAME if(q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1;  
 
-       //temp testing
-               /*if(bg->tx >= 0 && bg->tx+20 < MAPX && player.tx == bg->tx + 10)
-               {
-                       for(q=1; q<=(TILEWH/SPEED); q++)
-                       {
-                               //INC_PER_FRAME;
-                               //animatePlayer(bg, spri, mask, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp);
-                               //animatePlayer(bg, spri, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp);
-                               mapScrollRight(bg, SPEED);
-                               //mapScrollRight(spri, SPEED);
-                               //mapScrollRight(mask, SPEED);
-                               modexShowPage(bg->page);
-                       }
-                       player.tx++;
-               }
-               else if(player.tx < MAPX)
-               {
-                       for(q=1; q<=(TILEWH/SPEED); q++)
-                       {
-                               INC_PER_FRAME;
-                               player.x+=SPEED;
-                               //animatePlayer(bg, spri, mask, 1, 0, player.x, player.y, persist_aniframe, q, &ptmp);
-                               animatePlayer(bg, spri, 1, 0, player.x, player.y, persist_aniframe, q, &ptmp);
-                               modexShowPage(spri->page);
-                       }
-                       player.tx++;
-               }
-               else
-               {
-break;
-               }*/
        if(keyp(77) && !keyp(75))
        {
                if(bg->tx >= 0 && bg->tx+20 < MAPX && player.tx == bg->tx + 10 && !(player.tx+1 == TRIGGX && player.ty == TRIGGY))
@@ -174,8 +141,8 @@ break;
                                INC_PER_FRAME;
                                //animatePlayer(bg, spri, mask, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp);
                                animatePlayer(bg, spri, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp);
-                               mapScrollRight(bg, SPEED, q);
-                               mapScrollRight(spri, SPEED, q);
+                               mapScrollRight(bg, SPEED);
+                               mapScrollRight(spri, SPEED);
                                //mapScrollRight(mask, SPEED);
                                modexShowPage(spri->page);
                        }
@@ -212,8 +179,8 @@ break;
                                INC_PER_FRAME;
                                //animatePlayer(bg, spri, mask, 3, 1, player.x, player.y, persist_aniframe, q, &ptmp);
                                animatePlayer(bg, spri, 3, 1, player.x, player.y, persist_aniframe, q, &ptmp);
-                               mapScrollLeft(bg, SPEED, q);
-                               mapScrollLeft(spri, SPEED, q);
+                               mapScrollLeft(bg, SPEED);
+                               mapScrollLeft(spri, SPEED);
                                //mapScrollLeft(mask, SPEED);
                                modexShowPage(spri->page);
                        }
@@ -250,8 +217,8 @@ break;
                                INC_PER_FRAME;
                                //animatePlayer(bg, spri, mask, 2, 1, player.x, player.y, persist_aniframe, q, &ptmp);
                                animatePlayer(bg, spri, 2, 1, player.x, player.y, persist_aniframe, q, &ptmp);
-                               mapScrollDown(bg, SPEED, q);
-                               mapScrollDown(spri, SPEED, q);
+                               mapScrollDown(bg, SPEED);
+                               mapScrollDown(spri, SPEED);
                                //mapScrollDown(mask, SPEED);
                                modexShowPage(spri->page);
                        }
@@ -288,8 +255,8 @@ break;
                                INC_PER_FRAME;
                                //animatePlayer(bg, spri, mask, 0, 1, player.x, player.y, persist_aniframe, q, &ptmp);
                                animatePlayer(bg, spri, 0, 1, player.x, player.y, persist_aniframe, q, &ptmp);
-                               mapScrollUp(bg, SPEED, q);
-                               mapScrollUp(spri, SPEED, q);
+                               mapScrollUp(bg, SPEED);
+                               mapScrollUp(spri, SPEED);
                                //mapScrollUp(mask, SPEED);
                                modexShowPage(spri->page);
                        }
@@ -408,7 +375,7 @@ initMap(map_t *map) {
 
 
 void
-mapScrollRight(map_view_t *mv, byte offset, short lp) {
+mapScrollRight(map_view_t *mv, byte offset) {
        word x, y;  /* coordinate for drawing */
 
        /* increment the pixel position and update the page */
@@ -425,14 +392,13 @@ mapScrollRight(map_view_t *mv, byte offset, short lp) {
 
        /* draw the next column */
        x= SCREEN_WIDTH + mv->map->tiles->tileWidth;
-       //if(lp%4)
-               mapDrawCol(mv, mv->tx + 20 , mv->ty-1, x, mv->page->dx);
+               mapDrawCol(mv, mv->tx + 20 , mv->ty-1, x);
        }
 }
 
 
 void
-mapScrollLeft(map_view_t *mv, byte offset, short lp) {
+mapScrollLeft(map_view_t *mv, byte offset) {
        word x, y;  /* coordinate for drawing */
 
        /* increment the pixel position and update the page */
@@ -448,14 +414,13 @@ mapScrollLeft(map_view_t *mv, byte offset, short lp) {
        mv->page->dx = mv->map->tiles->tileWidth;
        //}
        /* draw the next column */
-       //if(lp%4)
-               mapDrawCol(mv, mv->tx-1, mv->ty-1, 0, mv->page->dx);
+               mapDrawCol(mv, mv->tx-1, mv->ty-1, 0);
        }
 }
 
 
 void
-mapScrollUp(map_view_t *mv, byte offset, short lp) {
+mapScrollUp(map_view_t *mv, byte offset) {
        word x, y;  /* coordinate for drawing */
 
        /* increment the pixel position and update the page */
@@ -472,14 +437,13 @@ mapScrollUp(map_view_t *mv, byte offset, short lp) {
 
        /* draw the next row */
        y= 0;
-       //if(lp%3)
-               mapDrawRow(mv, mv->tx-1 , mv->ty-1, y, mv->page->dy);
+               mapDrawRow(mv, mv->tx-1 , mv->ty-1, y);
        }
 }
 
 
 void
-mapScrollDown(map_view_t *mv, byte offset, short lp) {
+mapScrollDown(map_view_t *mv, byte offset) {
        word x, y;  /* coordinate for drawing */
 
        /* increment the pixel position and update the page */
@@ -496,8 +460,7 @@ mapScrollDown(map_view_t *mv, byte offset, short lp) {
 
        /* draw the next row */
        y= SCREEN_HEIGHT + mv->map->tiles->tileHeight;
-       //if(lp%3)
-               mapDrawRow(mv, mv->tx-1 , mv->ty+15, y, mv->page->dy);
+               mapDrawRow(mv, mv->tx-1 , mv->ty+15, y);
        }
 
 }
@@ -523,7 +486,7 @@ mapGoTo(map_view_t *mv, int tx, int ty) {
        py=0;
        i=mv->ty * mv->map->width + mv->tx;
        for(ty=mv->ty-1; py < SCREEN_HEIGHT+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) {
-               mapDrawWRow(mv, tx-1, ty, py);
+               mapDrawRow(mv, tx-1, ty, py);
        i+=mv->map->width - tx;
        }
 }
@@ -540,45 +503,7 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) {
 
 
 void 
-mapDrawRow(map_view_t *mv, int tx, int ty, word y, word poopoffset) {
-       word x;
-       int i;
-       poopoffset%=SPEED;
-printf("y: %d\n", poopoffset);
-       /* the position within the map array */
-       i=ty * mv->map->width + tx;
-       for(x=poopoffset; x<(SCREEN_WIDTH+mv->dxThresh)/(poopoffset+1) && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) {
-       if(i>=0) {
-               /* we are in the map, so copy! */
-               mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);
-       }
-       i++; /* next! */
-       }
-}
-
-
-void 
-mapDrawCol(map_view_t *mv, int tx, int ty, word x, word poopoffset) {
-       int y;
-       int i;
-       poopoffset%=SPEED;
-printf("x: %d\n", poopoffset);
-       /* location in the map array */
-       i=ty * mv->map->width + tx;
-
-       /* We'll copy all of the columns in the screen, 
-          i + 1 row above and one below */
-       for(y=poopoffset; y<(SCREEN_HEIGHT+mv->dyThresh)/(poopoffset+1) && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) {
-       if(i>=0) {
-               /* we are in the map, so copy away! */
-               mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);
-       }
-       i += mv->map->width;
-       }
-}
-
-void 
-mapDrawWRow(map_view_t *mv, int tx, int ty, word y) {
+mapDrawRow(map_view_t *mv, int tx, int ty, word y) {
        word x;
        int i;
 
@@ -594,7 +519,7 @@ mapDrawWRow(map_view_t *mv, int tx, int ty, word y) {
 }
 
 void 
-mapDrawWCol(map_view_t *mv, int tx, int ty, word x) {
+mapDrawCol(map_view_t *mv, int tx, int ty, word x) {
        int y;
        int i;