X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fscroll16.c;h=a60d13ea7e80821531e63b8d471b30cd336631b4;hb=2eb78909ad7e8079fbec7dbe794fe0eac01e15de;hp=63a54d459f388a4a1639b96def006b7774324143;hpb=0f1f17dc05c1f9530651580fc5c23b121b8969ab;p=16.git diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 63a54d45..a60d13ea 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -31,7 +31,8 @@ void walk(map_view_t *pip, player_t *player, word pn) { //right movement case 3: - if(pip[0].tx >= 0 && pip[0].tx+20 < pip[0].map->width && player[pn].tx == pip[0].tx + 10 && + //printf("pip[0].page->tilesw=%d\n", pip[0].page->tilesw); + if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tilesw < pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! { if(player[pn].q<=(TILEWH/(player[pn].speed))) @@ -59,8 +60,11 @@ void walk(map_view_t *pip, player_t *player, word pn) { modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE - modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 24, 32, &player[pn].data); +#ifdef BMPTYPE + modexDrawPBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 24, 32, &player[pn].data, 1); #else + modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 24, 32, &player[pn].data); +#endif modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 14); #endif modexShowPage(pip[1].page); @@ -72,7 +76,7 @@ void walk(map_view_t *pip, player_t *player, word pn) //left movement case 1: - if(pip[0].tx > 0 && pip[0].tx+20 <= pip[0].map->width && player[pn].tx == pip[0].tx + 10 && + if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tilesw <= pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! { if(player[pn].q<=(TILEWH/(player[pn].speed))) @@ -100,7 +104,11 @@ void walk(map_view_t *pip, player_t *player, word pn) { modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE +#ifdef BMPTYPE + modexDrawPBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 96, 24, 32, &player[pn].data, 1); +#else modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 96, 24, 32, &player[pn].data); +#endif #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 10); #endif @@ -113,7 +121,7 @@ void walk(map_view_t *pip, player_t *player, word pn) //down movement case 4: - if(pip[0].ty >= 0 && pip[0].ty+15 < pip[0].map->height && player[pn].ty == pip[0].ty + 8 && + if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->tilesh < pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY)) //collision detection! { if(player[pn].q<=(TILEWH/(player[pn].speed))) @@ -141,7 +149,11 @@ void walk(map_view_t *pip, player_t *player, word pn) { modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE +#ifdef BMPTYPE + modexDrawPBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 64, 24, 32, &player[pn].data, 1); +#else modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 64, 24, 32, &player[pn].data); +#endif #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 9); #endif @@ -154,7 +166,7 @@ void walk(map_view_t *pip, player_t *player, word pn) //up movement case 0: - if(pip[0].ty > 0 && pip[0].ty+15 <= pip[0].map->height && player[pn].ty == pip[0].ty + 8 && + if(pip[0].ty > 0 && pip[0].ty+pip[0].page->tilesh <= pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY)) //collision detection! { if(player[pn].q<=(TILEWH/(player[pn].speed))) @@ -182,7 +194,11 @@ void walk(map_view_t *pip, player_t *player, word pn) { modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x-4, player[pn].y-TILEWH, player[pn].x-4, player[pn].y-TILEWH, 24, 32); #ifdef SPRITE +#ifdef BMPTYPE + modexDrawPBufRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 0, 24, 32, &player[pn].data, 1); +#else modexDrawSpriteRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 0, 24, 32, &player[pn].data); +#endif #else modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 12); #endif @@ -300,12 +316,12 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) } /* draw the next column */ - x= SCREEN_WIDTH + mv[id].map->tiles->tileWidth; + x= mv[0].page->sw + mv[id].map->tiles->tileWidth; if(player[plid].q%4) if(id==0) - mapDrawCol(&mv[0], mv[0].tx + 20 , mv[0].ty-1, x, player, mv->page->dx); + mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tilesw, mv[0].ty-1, x, player, mv->page->dx); else - modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*17); + modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->tilesh+2)); //} } @@ -334,7 +350,7 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) if(id==0) mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page->dx); else - modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*17); + modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->tilesh+2)); //} } @@ -362,7 +378,7 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) if(id==0) mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page->dy); else - modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*22, mv[id].map->tiles->tileHeight); + modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tilesw+2), mv[id].map->tiles->tileHeight); //} } @@ -384,12 +400,12 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) } /* draw the next row */ - y= SCREEN_HEIGHT + mv[id].map->tiles->tileHeight; + y= mv[0].page->sh + mv[id].map->tiles->tileHeight; if(player[plid].q%3) if(id==0) - mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+15, y, player, mv->page->dy); + mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->tilesh, y, player, mv->page->dy); else - modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*22, mv[id].map->tiles->tileHeight); + modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tilesw+2), mv[id].map->tiles->tileHeight); //} } @@ -455,7 +471,7 @@ void mapGoTo(map_view_t *mv, int tx, int ty) modexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0); 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) { + for(ty=mv->ty-1; py < mv->page->sh+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) { mapDrawWRow(mv, tx-1, ty, py); i+=mv->map->width - tx; } @@ -486,8 +502,13 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) #ifndef SPRITE modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, ((t->debug_data[i])+1)*2); //cannot print number value du to it being slow as bakapee +#else +#ifdef BMPTYPE + modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, ((t->debug_data[i])+1)*2); + //modexDrawPBufRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data), 0); #else modexDrawBmpRegion(page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); +#endif #endif break; case 1: @@ -513,7 +534,7 @@ void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *p, word p //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++) { + for(x=poopoffset; x<(mv->page->sw+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); @@ -533,7 +554,7 @@ void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *p, word p /* 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++) { + for(y=poopoffset; y<(mv->page->sh+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); @@ -549,7 +570,7 @@ void mapDrawWRow(map_view_t *mv, int tx, int ty, word y) /* the position within the map array */ i=ty * mv->map->width + tx; - for(x=0; xdxThresh && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) { + for(x=0; xpage->sw+mv->dxThresh && 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); @@ -568,7 +589,7 @@ void mapDrawWCol(map_view_t *mv, int tx, int ty, word x) /* We'll copy all of the columns in the screen, i + 1 row above and one below */ - for(y=0; ydyThresh && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) { + for(y=0; ypage->sh+mv->dyThresh && 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); @@ -579,15 +600,14 @@ void mapDrawWCol(map_view_t *mv, int tx, int ty, word x) /*void qclean() { - modexLeave(); //setkb(0); }*/ /* sync */ -void shinku(page_t *page, global_game_variables_t *gv) +void shinku(map_view_t *pip, global_game_variables_t *gv) { //float t; - static byte *pee; + //modexCopyPageRegion(pip[1].page, pip[2].page, 16, 16, 16, 16, (14*8)+4, 8+4); if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second)) { word x = (16); @@ -595,10 +615,9 @@ void shinku(page_t *page, global_game_variables_t *gv) word col = 15; word bgcol = 0; word type = 1; - pee = _fmalloc(sizeof(byte)*2); //t=(((*(gv->clock))-gv->clock_start) /18.2); - sprintf(pee, "%f", (double)gv->kurokku.tiku/ticktock(gv)); - modexprint(page, 16, 16, 1, 15, 0, pee); + sprintf(gv->pee, "%f fps", (double)gv->kurokku.tiku/ticktock(gv)); + modexprint(pip[1].page, 16, 16, 1, 15, 0, gv->pee); //(gv->clock_start)=*(gv->clock); gv->kurokku.tiku=0; } @@ -662,10 +681,10 @@ void near animatePlayer(map_view_t *pip, player_t *player, word playnum, sword s #ifdef SPRITE #ifdef BMPTYPE -#define FRAME1 oldDrawBmp(VGA, x, y, &player[playnum].data, 1); -#define FRAME2 oldDrawBmp(VGA, x, y, &player[playnum].data, 1); -#define FRAME3 oldDrawBmp(VGA, x, y, &player[playnum].data, 1); -#define FRAME4 oldDrawBmp(VGA, x, y, &player[playnum].data, 1); +#define FRAME1 modexDrawPBufRegion(pip[1].page, x, y, 48, dire, 24, 32, &player[playnum].data, 1); +#define FRAME2 modexDrawPBufRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data, 1); +#define FRAME3 modexDrawPBufRegion(pip[1].page, x, y, 0, dire, 24, 32, &player[playnum].data, 1); +#define FRAME4 modexDrawPBufRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data, 1); #else #define FRAME1 modexDrawSpriteRegion(pip[1].page, x, y, 48, dire, 24, 32, &player[playnum].data); #define FRAME2 modexDrawSpriteRegion(pip[1].page, x, y, 24, dire, 24, 32, &player[playnum].data); @@ -679,6 +698,7 @@ void near animatePlayer(map_view_t *pip, player_t *player, word playnum, sword s #define FRAME4 modexClearRegion(pip[1].page, x, y, 24, 32, 1+dire); #endif modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 40); + //modexCopyPageRegion(pip[2].page, pip[1].page, 16, 16, 16, 16, (14*8)+4, 8+4); if(2>ls && ls>=1) { FRAME1 }else if(3>ls && ls>=2) { FRAME2 }else if(4>ls && ls>=3) { FRAME3 }else