From: sparky4 Date: Sun, 23 Nov 2014 21:46:16 +0000 (-0600) Subject: modified: Project 16.bfproject X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=16f25a21a4f28d78ef3a4bb886bfcbc7383daa1f;p=16.git modified: Project 16.bfproject modified: modex16.h modified: scroll.c modified: scroll.exe --- diff --git a/Project 16.bfproject b/Project 16.bfproject index 3a2786fe..698c75de 100644 --- a/Project 16.bfproject +++ b/Project 16.bfproject @@ -1,9 +1,9 @@ c2e.convert_special: 0 e2c.convert_num: 0 openfiles: /dos/z/16/doc/project.txt:0:0:0: -openfiles: /dos/z/16/scroll.c:12102:11962:1: -openfiles: /dos/z/16/modex16.c:6464:6244:0: -openfiles: /dos/z/16/modex16.h:1191:2119:0: +openfiles: /dos/z/16/scroll.c:4669:4145:1: +openfiles: /dos/z/16/modex16.c:2077:556:0: +openfiles: /dos/z/16/modex16.h:1150:0:0: snr_recursion_level: 0 convertcolumn_horizontally: 0 adv_open_matchname: 0 @@ -18,7 +18,7 @@ c2e.convert_iso: 0 opendir: file:///dos/z/16 wrap_text_default: 0 bookmarks_filename_mode: 1 -ssearch_text: color +ssearch_text: modexShowPage(spri->page); snr_casesens: 1 view_blocks: 1 name: project 16 @@ -27,9 +27,11 @@ replacelist: \t replacelist: putPixel_X replacelist: SCREEN_WIDTH replacelist: SCREEN_HEIGHT -replacelist: animatePlayer(spri -replacelist: animatePlayer(draw replacelist: modexClearPlayer(mv->page +replacelist: animatePlayer(draw +replacelist: animatePlayer(spri +replacelist: modexDrawSpriteRegion(spri +replacelist: spri->page = modexDefaultPage(); fb_show_hidden_f: 0 editor_tab_width: 4 show_visible_spacing: 1 @@ -104,11 +106,6 @@ snr_escape_chars: 0 htmlbar_view: 0 spell_lang: en ssearch_dotmatchall: 0 -searchlist: mapScrollRight -searchlist: 32 -searchlist: map.dat -searchlist: int index -searchlist: draw searchlist: SC_INDEX searchlist: gq searchlist: setvideo @@ -118,7 +115,12 @@ searchlist: color 0 searchlist: sprite searchlist: clear searchlist: modexClearRegion(mv->page +searchlist: animatePlayer(spri searchlist: color +searchlist: modexShowPage(spri->page); +searchlist: animatePlayer(draw +searchlist: modexDrawSpriteRegion(draw +searchlist: spri->page=NULL; autocomplete: 1 outputb_show_all_output: 0 bookmarks_show_mode: 0 diff --git a/modex16.h b/modex16.h index 855042ff..9ee36908 100644 --- a/modex16.h +++ b/modex16.h @@ -34,7 +34,8 @@ void modexClearPlayer(page_t *page, int x, int y, int w, int h); void modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp); void modexDrawBmpRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp); void modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp); -void modexDrawSpriteRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp); +void modexDrawSpriteRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp); +void modexCopyPageRegion(page_t *dest, page_t *src, word sx, word sy, word dx, word dy, word width, word height); /* Palette fade and flash effects */ void modexFadeOn(word fade, byte *palette); diff --git a/scroll.c b/scroll.c index 65ea0279..314d5bd7 100644 --- a/scroll.c +++ b/scroll.c @@ -51,7 +51,7 @@ 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); void mapDrawCol(map_view_t *mv, int tx, int ty, word x); -void animatePlayer(map_view_t *mv, short d1, short d2, int x, int y, int ls, bitmap_t *bmp); +void animatePlayer(map_view_t *mv, map_view_t *src, short d1, short d2, int x, int y, int ls, bitmap_t *bmp); #define TILEWH 16 #define QUADWH (TILEWH/4) @@ -85,14 +85,14 @@ void main() { screen = modexDefaultPage(); screen.width += (TILEWH*2); mv.page = &screen; - screen2=modexNextPage(mv.page); + screen2 = modexNextPage(mv.page); + screen2.width += (TILEWH*2); mv2.page = &screen2; - modexShowPage(mv.page); + //modexShowPage(mv.page); /* set up paging */ draw = &mv; spri = &mv2; -// draw = &mv; //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen mapGoTo(draw, 0, 0); @@ -104,9 +104,9 @@ void main() { player.ty = draw->ty + 8; player.x = player.tx*TILEWH; player.y = player.ty*TILEWH; - modexDrawSpriteRegion(draw->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp); - - modexShowPage(draw->page); + modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp); + modexCopyPageRegion(spri->page, draw->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 34); + modexShowPage(spri->page); while(!keyp(1)) { //top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square @@ -116,17 +116,14 @@ void main() { //TODO: render the player properly with animation and sprite sheet if(keyp(77)) { - modexDrawSpriteRegion(draw->page, player.x-4, player.y-TILEWH, 24, 32, 24, 32, &ptmp); + modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 32, 24, 32, &ptmp); if(draw->tx >= 0 && draw->tx+20 < MAPX && player.tx == draw->tx + 10) { for(q=0; q<(TILEWH/SPEED); q++) - { -// modexDrawBmp(draw->page, &bmp); - animatePlayer(draw, 1, 1, player.x, player.y, q, &ptmp); + { + animatePlayer(spri, draw, 1, 1, player.x, player.y, q, &ptmp); mapScrollRight(draw, SPEED); - modexShowPage(draw->page); -// mapScrollRight(show, SPEED); -// SWAP(draw, show); + modexShowPage(spri->page); } player.tx++; } @@ -135,10 +132,8 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { player.x+=SPEED; -// modexDrawBmp(draw->page, player.x, player.y, &bmp); - animatePlayer(draw, 1, 0, player.x, player.y, q, &ptmp); - modexShowPage(draw->page); -// SWAP(draw, show); + animatePlayer(spri, draw, 1, 0, player.x, player.y, q, &ptmp); + modexShowPage(spri->page); } player.tx++; } @@ -146,17 +141,15 @@ void main() { if(keyp(75)) { - modexDrawSpriteRegion(draw->page, player.x-4, player.y-TILEWH, 24, 96, 24, 32, &ptmp); + modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 96, 24, 32, &ptmp); if(draw->tx > 0 && draw->tx+20 <= MAPX && player.tx == draw->tx + 10) { for(q=0; q<(TILEWH/SPEED); q++) { -// modexDrawBmp(draw->page, player.x-((q+1)*SPEED), player.y, &bmp); - animatePlayer(draw, 3, 1, player.x, player.y, q, &ptmp); + + animatePlayer(spri, draw, 3, 1, player.x, player.y, q, &ptmp); mapScrollLeft(draw, SPEED); - modexShowPage(draw->page); -// mapScrollLeft(show, SPEED); -// SWAP(draw, show); + modexShowPage(spri->page); } player.tx--; } @@ -165,10 +158,8 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { player.x-=SPEED; -// modexDrawBmp(draw->page, player.x, player.y, &bmp); - animatePlayer(draw, 3, 0, player.x, player.y, q, &ptmp); - modexShowPage(draw->page); -// SWAP(draw, show); + animatePlayer(spri, draw, 3, 0, player.x, player.y, q, &ptmp); + modexShowPage(spri->page); } player.tx--; } @@ -176,17 +167,14 @@ void main() { if(keyp(80)) { - modexDrawSpriteRegion(draw->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp); + modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp); if(draw->ty >= 0 && draw->ty+15 < MAPY && player.ty == draw->ty + 8) { for(q=0; q<(TILEWH/SPEED); q++) { -// modexDrawBmp(draw->page, player.x, player.y+((q+1)*SPEED), &bmp); - animatePlayer(draw, 2, 1, player.x, player.y, q, &ptmp); + animatePlayer(spri, draw, 2, 1, player.x, player.y, q, &ptmp); mapScrollDown(draw, SPEED); - modexShowPage(draw->page); -// mapScrollDown(show, SPEED); -// SWAP(draw, show); + modexShowPage(spri->page); } player.ty++; } @@ -195,10 +183,8 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { player.y+=SPEED; -// modexDrawBmp(draw->page, player.x, player.y, &bmp); - animatePlayer(draw, 2, 0, player.x, player.y, q, &ptmp); - modexShowPage(draw->page); -// SWAP(draw, show); + animatePlayer(spri, draw, 2, 0, player.x, player.y, q, &ptmp); + modexShowPage(spri->page); } player.ty++; } @@ -206,17 +192,15 @@ void main() { if(keyp(72)) { - modexDrawSpriteRegion(draw->page, player.x-4, player.y-TILEWH, 24, 0, 24, 32, &ptmp); + modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 0, 24, 32, &ptmp); if(draw->ty > 0 && draw->ty+15 <= MAPY && player.ty == draw->ty + 8) { for(q=0; q<(TILEWH/SPEED); q++) - { -// modexDrawBmp(draw->page, player.x, player.y-((q+1)*SPEED), &bmp); - animatePlayer(draw, 0, 1, player.x, player.y, q, &ptmp); + { + animatePlayer(spri, draw, 0, 1, player.x, player.y, q, &ptmp); mapScrollUp(draw, SPEED); - modexShowPage(draw->page); -// mapScrollUp(show, SPEED); -// SWAP(draw, show); + mapScrollUp(spri, SPEED); + modexShowPage(spri->page); } player.ty--; } @@ -225,14 +209,13 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { player.y-=SPEED; -// modexDrawBmp(draw->page, player.x, player.y, &bmp); - animatePlayer(draw, 0, 0, player.x, player.y, q, &ptmp); - modexShowPage(draw->page); -// SWAP(draw, show); + animatePlayer(spri, draw, 0, 0, player.x, player.y, q, &ptmp); + modexShowPage(spri->page); } player.ty--; } - } + } + } modexLeave(); @@ -464,7 +447,7 @@ mapDrawCol(map_view_t *mv, int tx, int ty, word x) { } } -void animatePlayer(map_view_t *mv, short d1, short d2, int x, int y, int ls, bitmap_t *bmp) +void animatePlayer(map_view_t *mv, map_view_t *src, short d1, short d2, int x, int y, int ls, bitmap_t *bmp) { int qq; @@ -474,35 +457,47 @@ void animatePlayer(map_view_t *mv, short d1, short d2, int x, int y, int ls, bit { case 0: //up - //if(ls==0) modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); - if(ls<1) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); } - if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 48, 0, 24, 32, bmp); } - if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 0, 0, 24, 32, bmp); } - if(ls>=7) { modexClearPlayer(mv->page, x-4, y-qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); } + if(ls<1) { modexCopyPageRegion(mv->page, src->page, x-4, y-qq-TILEWH, x-4, y-qq-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); } + if(4>ls && ls>=1) { modexCopyPageRegion(mv->page, src->page, x-4, y-qq-TILEWH, x-4, y-qq-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 48, 0, 24, 32, bmp); } + if(7>ls && ls>=4) { modexCopyPageRegion(mv->page, src->page, x-4, y-qq-TILEWH, x-4, y-qq-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 0, 0, 24, 32, bmp); } + if(ls>=7) { modexCopyPageRegion(mv->page, src->page, x-4, y-qq-TILEWH, x-4, y-qq-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-4, y-qq-TILEWH, 24, 0, 24, 32, bmp); } break; case 1: // right - //if(ls==0) modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); - if(ls<1) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); } - if(4>ls && ls>=1) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 48, 32, 24, 32, bmp); } - if(7>ls && ls>=4) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 0, 32, 24, 32, bmp); } - if(ls>=7) { modexClearPlayer(mv->page, x+qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); } + if(ls<1) { modexCopyPageRegion(mv->page, src->page, x+qq-4, y-TILEWH, x+qq-4, y-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); } + if(4>ls && ls>=1) { modexCopyPageRegion(mv->page, src->page, x+qq-4, y-TILEWH, x+qq-4, y-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 48, 32, 24, 32, bmp); } + if(7>ls && ls>=4) { modexCopyPageRegion(mv->page, src->page, x+qq-4, y-TILEWH, x+qq-4, y-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 0, 32, 24, 32, bmp); } + if(ls>=7) { modexCopyPageRegion(mv->page, src->page, x+qq-4, y-TILEWH, x+qq-4, y-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); } break; case 2: //down - //if(ls==0) modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); - if(ls<1) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); } - if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 48, 64, 24, 32, bmp); } - if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 0, 64, 24, 32, bmp); } - if(ls>=7) { modexClearPlayer(mv->page, x-4, y+qq-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); } + if(ls<1) { modexCopyPageRegion(mv->page, src->page, x-4, y+qq-TILEWH, x-4, y+qq-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); } + if(4>ls && ls>=1) { modexCopyPageRegion(mv->page, src->page, x-4, y+qq-TILEWH, x-4, y+qq-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 48, 64, 24, 32, bmp); } + if(7>ls && ls>=4) { modexCopyPageRegion(mv->page, src->page, x-4, y+qq-TILEWH, x-4, y+qq-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 0, 64, 24, 32, bmp); } + if(ls>=7) { modexCopyPageRegion(mv->page, src->page, x-4, y+qq-TILEWH, x-4, y+qq-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); } break; case 3: //left - //if(ls==0) modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); - if(ls<1) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); } - if(4>ls && ls>=1) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 48, 96, 24, 32, bmp); } - if(7>ls && ls>=4) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 0, 96, 24, 32, bmp); } - if(ls>=7) { modexClearPlayer(mv->page, x-qq-4, y-TILEWH, 24, 32); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); } + if(ls<1) { modexCopyPageRegion(mv->page, src->page, x-qq-4, y-TILEWH, x-qq-4, y-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); } + if(4>ls && ls>=1) { modexCopyPageRegion(mv->page, src->page, x-qq-4, y-TILEWH, x-qq-4, y-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 48, 96, 24, 32, bmp); } + if(7>ls && ls>=4) { modexCopyPageRegion(mv->page, src->page, x-qq-4, y-TILEWH, x-qq-4, y-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 0, 96, 24, 32, bmp); } + if(ls>=7) { modexCopyPageRegion(mv->page, src->page, x-qq-4, y-TILEWH, x-qq-4, y-TILEWH, 24, 34); + modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); } break; } } diff --git a/scroll.exe b/scroll.exe index 6bf9ba9f..90acc470 100644 Binary files a/scroll.exe and b/scroll.exe differ