From 52d601d36c9ca70c321cda39bae6c9a9340a892a Mon Sep 17 00:00:00 2001 From: sparky4 Date: Sun, 23 Nov 2014 16:08:31 -0600 Subject: [PATCH] modified: scroll.c modified: scroll.exe --- scroll.c | 109 ++++++++++++++++++++++++++++------------------------- scroll.exe | Bin 21288 -> 21160 bytes 2 files changed, 58 insertions(+), 51 deletions(-) diff --git a/scroll.c b/scroll.c index 314d5bd7..169d3606 100644 --- a/scroll.c +++ b/scroll.c @@ -67,17 +67,17 @@ void main() { page_t screen, screen2; map_t map; map_view_t mv, mv2; - map_view_t *draw, *spri, *tmp; + map_view_t *bg, *spri, *tmp; byte *ptr; setkb(1); /* create the map */ - map = allocMap(MAPX,MAPY); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly + map = allocMap(MAPX,MAPY); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be bgn properly initMap(&map); mv.map = ↦ mv2.map = ↦ - /* draw the tiles */ + /* bg the tiles */ ptr = map.data; ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite modexEnter(); @@ -91,21 +91,21 @@ void main() { //modexShowPage(mv.page); /* set up paging */ - draw = &mv; + bg = &mv; spri = &mv2; //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen - mapGoTo(draw, 0, 0); + mapGoTo(bg, 0, 0); mapGoTo(spri, 0, 0); //TODO: put player in starting position of spot //default player position on the viewable map - player.tx = draw->tx + 10; - player.ty = draw->ty + 8; + player.tx = bg->tx + 10; + player.ty = bg->ty + 8; player.x = player.tx*TILEWH; player.y = player.ty*TILEWH; 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); + modexCopyPageRegion(bg->page, spri->page, player.x-4, player.y-TILEWH-2, player.x-4, player.y-TILEWH-2, 24, 34); modexShowPage(spri->page); while(!keyp(1)) { @@ -116,13 +116,15 @@ void main() { //TODO: render the player properly with animation and sprite sheet if(keyp(77)) { - 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) + //modexCopyPageRegion(bg->page, spri->page, player.x-4, player.y-TILEWH-2, player.x-4, player.y-TILEWH-2, 24, 34); + //modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 32, 24, 32, &ptmp); + if(bg->tx >= 0 && bg->tx+20 < MAPX && player.tx == bg->tx + 10) { for(q=0; q<(TILEWH/SPEED); q++) { - animatePlayer(spri, draw, 1, 1, player.x, player.y, q, &ptmp); - mapScrollRight(draw, SPEED); + animatePlayer(spri, bg, 1, 1, player.x, player.y, q, &ptmp); + mapScrollRight(bg, SPEED); + mapScrollRight(spri, SPEED); modexShowPage(spri->page); } player.tx++; @@ -132,7 +134,7 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { player.x+=SPEED; - animatePlayer(spri, draw, 1, 0, player.x, player.y, q, &ptmp); + animatePlayer(spri, bg, 1, 0, player.x, player.y, q, &ptmp); modexShowPage(spri->page); } player.tx++; @@ -141,14 +143,16 @@ void main() { if(keyp(75)) { - 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) + //modexCopyPageRegion(bg->page, spri->page, player.x-4, player.y-TILEWH-2, player.x-4, player.y-TILEWH-2, 24, 34); + //modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 96, 24, 32, &ptmp); + if(bg->tx > 0 && bg->tx+20 <= MAPX && player.tx == bg->tx + 10) { for(q=0; q<(TILEWH/SPEED); q++) { - animatePlayer(spri, draw, 3, 1, player.x, player.y, q, &ptmp); - mapScrollLeft(draw, SPEED); + animatePlayer(spri, bg, 3, 1, player.x, player.y, q, &ptmp); + mapScrollLeft(bg, SPEED); + mapScrollLeft(spri, SPEED); modexShowPage(spri->page); } player.tx--; @@ -158,7 +162,7 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { player.x-=SPEED; - animatePlayer(spri, draw, 3, 0, player.x, player.y, q, &ptmp); + animatePlayer(spri, bg, 3, 0, player.x, player.y, q, &ptmp); modexShowPage(spri->page); } player.tx--; @@ -167,13 +171,15 @@ void main() { if(keyp(80)) { - 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) + //modexCopyPageRegion(bg->page, spri->page, player.x-4, player.y-TILEWH-2, player.x-4, player.y-TILEWH-2, 24, 34); + //modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp); + if(bg->ty >= 0 && bg->ty+15 < MAPY && player.ty == bg->ty + 8) { for(q=0; q<(TILEWH/SPEED); q++) { - animatePlayer(spri, draw, 2, 1, player.x, player.y, q, &ptmp); - mapScrollDown(draw, SPEED); + animatePlayer(spri, bg, 2, 1, player.x, player.y, q, &ptmp); + mapScrollDown(bg, SPEED); + mapScrollDown(spri, SPEED); modexShowPage(spri->page); } player.ty++; @@ -183,7 +189,7 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { player.y+=SPEED; - animatePlayer(spri, draw, 2, 0, player.x, player.y, q, &ptmp); + animatePlayer(spri, bg, 2, 0, player.x, player.y, q, &ptmp); modexShowPage(spri->page); } player.ty++; @@ -192,13 +198,14 @@ void main() { if(keyp(72)) { - 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) + //modexCopyPageRegion(bg->page, spri->page, player.x-4, player.y-TILEWH-2, player.x-4, player.y-TILEWH-2, 24, 34); + //modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 0, 24, 32, &ptmp); + if(bg->ty > 0 && bg->ty+15 <= MAPY && player.ty == bg->ty + 8) { for(q=0; q<(TILEWH/SPEED); q++) { - animatePlayer(spri, draw, 0, 1, player.x, player.y, q, &ptmp); - mapScrollUp(draw, SPEED); + animatePlayer(spri, bg, 0, 1, player.x, player.y, q, &ptmp); + mapScrollUp(bg, SPEED); mapScrollUp(spri, SPEED); modexShowPage(spri->page); } @@ -209,7 +216,7 @@ void main() { for(q=0; q<(TILEWH/SPEED); q++) { player.y-=SPEED; - animatePlayer(spri, draw, 0, 0, player.x, player.y, q, &ptmp); + animatePlayer(spri, bg, 0, 0, player.x, player.y, q, &ptmp); modexShowPage(spri->page); } player.ty--; @@ -221,8 +228,8 @@ void main() { modexLeave(); setkb(0); printf("Project 16 scroll.exe\n"); - printf("tx: %d\n", draw->tx); - printf("ty: %d\n", draw->ty); + printf("tx: %d\n", bg->tx); + printf("ty: %d\n", bg->ty); printf("player.x: %d\n", player.x); printf("player.y: %d\n", player.y); printf("player.tx: %d\n", player.tx); @@ -285,7 +292,7 @@ initMap(map_t *map) { void mapScrollRight(map_view_t *mv, byte offset) { - word x, y; /* coordinate for drawing */ + word x, y; /* coordinate for bging */ /* increment the pixel position and update the page */ mv->page->dx += offset; @@ -299,7 +306,7 @@ mapScrollRight(map_view_t *mv, byte offset) { mv->page->dx = mv->map->tiles->tileWidth; - /* draw the next column */ + /* bg the next column */ x= SCREEN_WIDTH + mv->map->tiles->tileWidth; mapDrawCol(mv, mv->tx + 20 , mv->ty-1, x); } @@ -308,7 +315,7 @@ mapScrollRight(map_view_t *mv, byte offset) { void mapScrollLeft(map_view_t *mv, byte offset) { - word x, y; /* coordinate for drawing */ + word x, y; /* coordinate for bging */ /* increment the pixel position and update the page */ mv->page->dx -= offset; @@ -322,7 +329,7 @@ mapScrollLeft(map_view_t *mv, byte offset) { mv->page->data -= 4; mv->page->dx = mv->map->tiles->tileWidth; - /* draw the next column */ + /* bg the next column */ mapDrawCol(mv, mv->tx-1, mv->ty-1, 0); } } @@ -330,7 +337,7 @@ mapScrollLeft(map_view_t *mv, byte offset) { void mapScrollUp(map_view_t *mv, byte offset) { - word x, y; /* coordinate for drawing */ + word x, y; /* coordinate for bging */ /* increment the pixel position and update the page */ mv->page->dy -= offset; @@ -344,7 +351,7 @@ mapScrollUp(map_view_t *mv, byte offset) { mv->page->dy = mv->map->tiles->tileHeight; - /* draw the next row */ + /* bg the next row */ y= 0; mapDrawRow(mv, mv->tx-1 , mv->ty-1, y); } @@ -353,7 +360,7 @@ mapScrollUp(map_view_t *mv, byte offset) { void mapScrollDown(map_view_t *mv, byte offset) { - word x, y; /* coordinate for drawing */ + word x, y; /* coordinate for bging */ /* increment the pixel position and update the page */ mv->page->dy += offset; @@ -367,7 +374,7 @@ mapScrollDown(map_view_t *mv, byte offset) { mv->page->dy = mv->map->tiles->tileHeight; - /* draw the next row */ + /* bg the next row */ y= SCREEN_HEIGHT + mv->map->tiles->tileHeight; mapDrawRow(mv, mv->tx-1 , mv->ty+15, y); } @@ -390,7 +397,7 @@ mapGoTo(map_view_t *mv, int tx, int ty) { mv->dxThresh = mv->map->tiles->tileWidth * 2; mv->dyThresh = mv->map->tiles->tileHeight * 2; - /* draw the tiles */ + /* bg the tiles */ modexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0); py=0; i=mv->ty * mv->map->width + mv->tx; @@ -468,35 +475,35 @@ void animatePlayer(map_view_t *mv, map_view_t *src, short d1, short d2, int x, i break; case 1: // right - if(ls<1) { modexCopyPageRegion(mv->page, src->page, x+qq-4, y-TILEWH, x+qq-4, y-TILEWH, 24, 34); + if(ls<1) { modexCopyPageRegion(mv->page, src->page, x+qq-4, y-TILEWH, x+qq-4, y-TILEWH, 24, 34);// modexWaitBorder(); 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); + if(4>ls && ls>=1) { modexCopyPageRegion(mv->page, src->page, x+qq-4, y-TILEWH, x+qq-4, y-TILEWH, 24, 34);// modexWaitBorder(); 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); + if(7>ls && ls>=4) { modexCopyPageRegion(mv->page, src->page, x+qq-4, y-TILEWH, x+qq-4, y-TILEWH, 24, 34);// modexWaitBorder(); 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); + if(ls>=7) { modexCopyPageRegion(mv->page, src->page, x+qq-4, y-TILEWH, x+qq-4, y-TILEWH, 24, 34);// modexWaitBorder(); modexDrawSpriteRegion(mv->page, x+qq-4, y-TILEWH, 24, 32, 24, 32, bmp); } break; case 2: //down - if(ls<1) { modexCopyPageRegion(mv->page, src->page, x-4, y+qq-TILEWH, x-4, y+qq-TILEWH, 24, 34); + if(ls<1) { modexCopyPageRegion(mv->page, src->page, x-4, y+qq-TILEWH-2, x-4, y+qq-TILEWH-2, 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); + if(4>ls && ls>=1) { modexCopyPageRegion(mv->page, src->page, x-4, y+qq-TILEWH-2, x-4, y+qq-TILEWH-2, 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); + if(7>ls && ls>=4) { modexCopyPageRegion(mv->page, src->page, x-4, y+qq-TILEWH-2, x-4, y+qq-TILEWH-2, 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); + if(ls>=7) { modexCopyPageRegion(mv->page, src->page, x-4, y+qq-TILEWH-2, x-4, y+qq-TILEWH-2, 24, 34); modexDrawSpriteRegion(mv->page, x-4, y+qq-TILEWH, 24, 64, 24, 32, bmp); } break; case 3: //left - if(ls<1) { modexCopyPageRegion(mv->page, src->page, x-qq-4, y-TILEWH, x-qq-4, y-TILEWH, 24, 34); + if(ls<1) { modexCopyPageRegion(mv->page, src->page, x-qq-4, y-TILEWH, x-qq-4, y-TILEWH, 24, 34);// modexWaitBorder(); 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); + if(4>ls && ls>=1) { modexCopyPageRegion(mv->page, src->page, x-qq-4, y-TILEWH, x-qq-4, y-TILEWH, 24, 34);// modexWaitBorder(); 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); + if(7>ls && ls>=4) { modexCopyPageRegion(mv->page, src->page, x-qq-4, y-TILEWH, x-qq-4, y-TILEWH, 24, 34);// modexWaitBorder(); 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); + if(ls>=7) { modexCopyPageRegion(mv->page, src->page, x-qq-4, y-TILEWH, x-qq-4, y-TILEWH, 24, 34);// modexWaitBorder(); modexDrawSpriteRegion(mv->page, x-qq-4, y-TILEWH, 24, 96, 24, 32, bmp); } break; } diff --git a/scroll.exe b/scroll.exe index 90acc4703b0572de8b558cbf0890c8d1486a7985..f7c0fafbfac4106e4817edda4d6f0f1a61176ae6 100644 GIT binary patch delta 2517 zcmai04Nz3q6~5=a{oe(Ve`WtbAS+tPY6Y@{6%Ze&q%IJCqQhclY^RfU(lim6OjuXv zg-qVOU}|rZ1{0^#A+b)I$=GhDd9IFK(LgXX7+aB1N*bfi-7Hv~P7Fca*ZX#XV3V}F z`|i8ndH0_0JLjHz_Z>X~N8bYXBRh_w0;EGKbOp)sel_i)Rx?6&6#tyeKNhH0ubBz2rv6mYYxNAH&Y47bkMGjMZO5jF%y;lWqw72sd z&kfq0SDY7mxvS)?I^H`+f@+a7+)x`({{$;?ipm{+#WX$U$r-J&{VNR8;*<=C zG-U|YjHE-P4%^gL_#Sqvf5cpm;v?!JsKjIH76{`)%_evYKdq^UMtoM&0(Y=k+YT?_ zZtZ4h!UNik%V!KRu>%apGI|cI!sZlwC?xDL6%6sB-DT z^?0*>102B5>CNzS{F>fnEjG%XiIP3Oot+^M4d(cRNc7H$&9h_$p3%Et60b32!2qr? zIN=xgSwof~%7&vXFN1G8_85zx41Z*>Fcv+2Il+ca#+7gtKVY;lXLb0XDGl#5=7NCt z8O`uheAwt*=h81>q|D(X(QtrKywxurE1ZGlq5?N3oK{X3yi1>2>|zB;Hct*?nX?DqT*U4E*o>^prqhZR>@ zimUFr|MoH)k51gH*?&O#HMo&W!p#ztL zpP6xiZIz)tsrB8uzh--+FmADJq1E+UTO$E||v6tDc5YJiIEO7T?UObeO=}TnnthdAV&6!hG(l z33bc(y-~DBCsyl7H_p#1PTsRj7>XQf6wZ(?Sr`z;NiBXd?@jm}PRZYvc}?#O?c1)g zM?M!mAYBRJR+*k!e;|i&XMQU%cr<@4nDO0w2fU5*9+-m%vE5-#)ad3XP0>kxfvt`* zc(^oypOZWC%4NC3F3ECi3!WhxjP%^S)N`R@s%O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