X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fscroll16.c;h=7f4ff16d57934b9325926c6f4d31bb4c244f8a41;hb=1159fe5a6cd0f8eaeee6e8584f5972d42e004073;hp=f2a16e3d6dffb957f5a73d4e3bcc47164a510493;hpb=0ac21de11c7d70ff39af46d8bec1d50418adbe25;p=16.git diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index f2a16e3d..7f4ff16d 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -224,7 +224,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dx+=4; + pip[pip[0].pan->pn].page[0].dx+=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; } @@ -237,7 +237,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dx-=4; + pip[pip[0].pan->pn].page[0].dx-=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; } @@ -250,7 +250,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dy+=4; + pip[pip[0].pan->pn].page[0].dy+=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; } @@ -263,7 +263,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dy-=4; + pip[pip[0].pan->pn].page[0].dy-=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; } @@ -284,7 +284,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dx+=4; + pip[pip[0].pan->pn].page[0].dx+=4; modexShowPageVsync(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; } @@ -297,7 +297,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dx-=4; + pip[pip[0].pan->pn].page[0].dx-=4; modexShowPageVsync(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; } @@ -310,7 +310,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dy+=4; + pip[pip[0].pan->pn].page[0].dy+=4; modexShowPageVsync(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; } @@ -323,7 +323,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dy-=4; + pip[pip[0].pan->pn].page[0].dy-=4; modexShowPageVsync(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; } @@ -333,6 +333,27 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn) //if (player[pn].d!=2) printf("player[%u].d=%u player[%u].q=%u\n", pn, player[pn].d, pn, player[pn].q); } +/* + * modex mv setup +*/ +void modexMVSetup(map_view_t *mv, map_t *map, pan_t *pan, global_game_variables_t *gv) +{ + byte i; + // 1st page + mv[0].page = &gv->video.page[0]; + mv[0].map = map; + mv[0].video = &gv->video; + mv[0].pan = pan; + + for(i=1;ivideo.num_of_pages;i++) + { + mv[i].page = &gv->video.page[i]; + mv[i].map = mv[0].map; + mv[i].video = mv[0].video; + mv[i].pan = mv[0].pan; + } +} + /*map_t allocMap(int w, int h) { map_t result; @@ -425,24 +446,24 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) word x;//, y; /* coordinate for drawing */ /* increment the pixel position and update the page */ - mv[id].page->dx += player[plid].speed; + mv[id].page[0].dx += player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page->dx >= mv[id].dxThresh ) + if(mv[id].page[0].dx >= mv[id].dxThresh ) { /* go forward one tile */ mv[id].tx++; /* Snap the origin forward */ mv[id].page->data += 4; - mv[id].page->dx = mv[id].map->tiles->tileWidth; + mv[id].page[0].dx = mv[id].map->tiles->tileWidth; } /* draw the next column */ x= mv[0].page->sw + mv[id].map->tiles->tileWidth; if(player[plid].q%4) if(id==0) - mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page->dx); + mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page[0].dx); else if(!pageflipflop && !pageploop) modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); @@ -455,24 +476,24 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) word x;//,y; /* coordinate for drawing */ /* decrement the pixel position and update the page */ - mv[id].page->dx -= player[plid].speed; + mv[id].page[0].dx -= player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page->dx == 0) + if(mv[id].page[0].dx == 0) { /* go backward one tile */ mv[id].tx--; /* Snap the origin backward */ mv[id].page->data -= 4; - mv[id].page->dx = mv[id].map->tiles->tileWidth; + mv[id].page[0].dx = mv[id].map->tiles->tileWidth; } /* draw the next column */ x= 0; if(player[plid].q%4) if(id==0) - mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page->dx); + mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page[0].dx); else if(!pageflipflop && !pageploop) modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); @@ -485,24 +506,24 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) word y;//x, /* coordinate for drawing */ /* decrement the pixel position and update the page */ - mv[id].page->dy -= player[plid].speed; + mv[id].page[0].dy -= player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page->dy == 0 ) + if(mv[id].page[0].dy == 0 ) { /* go down one tile */ mv[id].ty--; /* Snap the origin downward */ mv[id].page->data -= mv[id].page->pi; - mv[id].page->dy = mv[id].map->tiles->tileHeight; + mv[id].page[0].dy = mv[id].map->tiles->tileHeight; } /* draw the next row */ y= 0; if(player[plid].q%3) if(id==0) - mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page->dy); + mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page[0].dy); else if(!pageflipflop && !pageploop) modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); @@ -514,24 +535,24 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) word y;//x, /* coordinate for drawing */ /* increment the pixel position and update the page */ - mv[id].page->dy += player[plid].speed; + mv[id].page[0].dy += player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page->dy >= mv[id].dyThresh ) + if(mv[id].page[0].dy >= mv[id].dyThresh ) { /* go down one tile */ mv[id].ty++; /* Snap the origin downward */ mv[id].page->data += mv[id].page->pi; - mv[id].page->dy = mv[id].map->tiles->tileHeight; + mv[id].page[0].dy = mv[id].map->tiles->tileHeight; } /* draw the next row */ 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+mv[0].page->th, y, player, mv->page->dy); + mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, mv->page[0].dy); else if(!pageflipflop && !pageploop) modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); @@ -543,68 +564,68 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) void near ScrollRight(map_view_t *mv, player_t *player, word id, word plid) { /* increment the pixel position and update the page */ - mv[id].page->dx += player[plid].speed; + mv[id].page[0].dx += player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page->dx >= mv[0].dxThresh ) + if(mv[id].page[0].dx >= mv[0].dxThresh ) { // vga_setup_wm1_block_copy(); // _fmemmove(mv[id].page->data+4, mv[id].page->data, mv[id].page->pagesize); // vga_restore_rm0wm0(); /* Snap the origin forward */ mv[id].page->data += 4; - mv[id].page->dx = mv[0].map->tiles->tileWidth; + mv[id].page[0].dx = mv[0].map->tiles->tileWidth; } } void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid) { /* decrement the pixel position and update the page */ - mv[id].page->dx -= player[plid].speed; + mv[id].page[0].dx -= player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page->dx == 0) + if(mv[id].page[0].dx == 0) { // vga_setup_wm1_block_copy(); // _fmemmove(mv[id].page->data-4, mv[id].page->data, mv[id].page->pagesize); // vga_restore_rm0wm0(); /* Snap the origin backward */ mv[id].page->data -= 4; - mv[id].page->dx = mv[0].map->tiles->tileWidth; + mv[id].page[0].dx = mv[0].map->tiles->tileWidth; } } void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid) { /* decrement the pixel position and update the page */ - mv[id].page->dy -= player[plid].speed; + mv[id].page[0].dy -= player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page->dy == 0) + if(mv[id].page[0].dy == 0) { // vga_setup_wm1_block_copy(); // _fmemmove(mv[id].page->data-mv[id].page->pi, mv[id].page->data, mv[id].page->pagesize); // vga_restore_rm0wm0(); /* Snap the origin backward */ mv[id].page->data -= mv[id].page->pi; - mv[id].page->dy = mv[0].map->tiles->tileWidth; + mv[id].page[0].dy = mv[0].map->tiles->tileWidth; } } void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid) { /* increment the pixel position and update the page */ - mv[id].page->dy += player[plid].speed; + mv[id].page[0].dy += player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page->dy >= mv[0].dxThresh ) + if(mv[id].page[0].dy >= mv[0].dxThresh ) { // vga_setup_wm1_block_copy(); // _fmemmove(mv[id].page->data+mv[id].page->pi, mv[id].page->data, mv[id].page->pagesize); // vga_restore_rm0wm0(); /* Snap the origin forward */ mv[id].page->data += mv[id].page->pi; - mv[id].page->dy = mv[0].map->tiles->tileWidth; + mv[id].page[0].dy = mv[0].map->tiles->tileWidth; } } @@ -640,14 +661,20 @@ sword chkmap(map_t *map, word q) //fix this to be far~ // bp = bitmapLoadPcx("data/ed.pcx"); // map->tiles->data = &bp; - map->tiles->debug_data = map->data; +#ifdef __DEBUG_MAP__ + dbg_mapdata = map->data; +#endif map->tiles->tileHeight = 16; map->tiles->tileWidth = 16; map->tiles->rows = 1; map->tiles->cols = 1; - map->tiles->debug_text = true; +#ifdef __DEBUG_MAP__ + dbg_maptext = true; +#endif } - else map->tiles->debug_text = false; +#ifdef __DEBUG_MAP__ + else dbg_maptext = false; +#endif return 0; } @@ -686,8 +713,8 @@ void mapinitmapview(map_view_t *mv, int tx, int ty) /* set up the coordinates */ mv[0].tx = mv[1].tx = tx; mv[0].ty = mv[1].ty = ty; - mv[0].page->dx = mv[1].page->dx = mv[2].page->dx = mv[3].page->dx = mv->map->tiles->tileWidth; - mv[0].page->dy = mv[1].page->dy = mv[2].page->dy = mv[3].page->dy = mv->map->tiles->tileHeight; + mv[0].page[0].dx = mv[1].page[0].dx = mv[2].page[0].dx = mv[3].page[0].dx = mv->map->tiles->tileWidth; + mv[0].page[0].dy = mv[1].page[0].dy = mv[2].page[0].dy = mv[3].page[0].dy = mv->map->tiles->tileHeight; /* set up the thresholds */ mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileWidth * 2; @@ -711,11 +738,13 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) rx = (((i-1) % ((t->data->width)/t->tileWidth)) * t->tileWidth); ry = (((i-1) / ((t->data->height)/t->tileHeight)) * t->tileHeight); ////0000printf("i=%d\n", i); - switch(t->debug_text) +#ifdef __DEBUG_MAP__ + switch(dbg_maptext) { case 0: +#endif #ifndef TILERENDER - modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, ((t->debug_data[i])+1)); + modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, ((dbg_mapdata[i])+1)); //modexprint(page, x, y, 1, 15, 0, (char const *)(t->debug_data[i])); #else PBUFBFUN (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); @@ -723,9 +752,10 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) //draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); //modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); #endif +#ifdef __DEBUG_MAP__ break; case 1: - modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, (t->debug_data[i])+1); + modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, (dbg_mapdata[i])+1); //modexprintbig(page, x, y, 1, 15, 0, (t->debug_data)); /*for(texty=0; texty<2; texty++) { @@ -736,6 +766,7 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) }*/ break; } +#endif } }