X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fscroll16.c;h=29461fae895649a28364214f81981be3d3ec3a1b;hb=1cc75f46d15728fed75f53a2243c9ad4c8234511;hp=5fbdb8cb6cdc1fd8face09715584ebf021dc410f;hpb=c86ea2ca9231b1c715e7bfdf16b4134d8fc27a71;p=16.git diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 5fbdb8cb..29461fae 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))) @@ -72,7 +73,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))) @@ -113,7 +114,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))) @@ -154,7 +155,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))) @@ -300,12 +301,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 +335,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 +363,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 +385,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 +456,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; } @@ -513,7 +514,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 +534,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 +550,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 +569,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,7 +580,6 @@ void mapDrawWCol(map_view_t *mv, int tx, int ty, word x) /*void qclean() { - modexLeave(); //setkb(0); }*/ @@ -587,7 +587,6 @@ void mapDrawWCol(map_view_t *mv, int tx, int ty, word x) 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)) { @@ -596,10 +595,9 @@ void shinku(map_view_t *pip, global_game_variables_t *gv) word col = 15; word bgcol = 0; word type = 1; - pee = _nmalloc(sizeof(byte)*2); //t=(((*(gv->clock))-gv->clock_start) /18.2); - sprintf(pee, "%f fps", (double)gv->kurokku.tiku/ticktock(gv)); - modexprint(pip[1].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; }