X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fscroll16.c;h=f1ec4cfeebbc32e0b9cdf7f28e7f520bf760ba41;hb=a6dac9aacc0353763dc564afda8b57848afc3e0b;hp=b0c9d3c70688f74c9146cc1208afd40ef8633124;hpb=22d35fc2e4df4a61e1d000c7cd59b8b253652a54;p=16.git diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index b0c9d3c7..f1ec4cfe 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -46,7 +46,7 @@ void walk(map_view_t *pip, player_t *player, word pn) animatePlayer(pip, player, pn, 1); ScrollRight(pip, player, 3, pn); ScrollRight(pip, player, 2, pn); - mapScrollRight(pip, player, !(pip[0].video->p), pn); + //mapScrollRight(pip, player, !(pip[0].video->p), pn); mapScrollRight(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; @@ -90,7 +90,7 @@ void walk(map_view_t *pip, player_t *player, word pn) animatePlayer(pip, player, pn, 1); ScrollLeft(pip, player, 3, pn); ScrollLeft(pip, player, 2, pn); - mapScrollLeft(pip, player, !(pip[0].video->p), pn); + //mapScrollLeft(pip, player, !(pip[0].video->p), pn); mapScrollLeft(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; @@ -134,7 +134,7 @@ void walk(map_view_t *pip, player_t *player, word pn) animatePlayer(pip, player, pn, 1); ScrollDown(pip, player, 3, pn); ScrollDown(pip, player, 2, pn); - mapScrollDown(pip, player, !(pip[0].video->p), pn); + //mapScrollDown(pip, player, !(pip[0].video->p), pn); mapScrollDown(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; @@ -178,7 +178,7 @@ void walk(map_view_t *pip, player_t *player, word pn) animatePlayer(pip, player, pn, 1); ScrollUp(pip, player, 3, pn); ScrollUp(pip, player, 2, pn); - mapScrollUp(pip, player, !(pip[0].video->p), pn); + //mapScrollUp(pip, player, !(pip[0].video->p), pn); mapScrollUp(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; @@ -214,7 +214,7 @@ void walk(map_view_t *pip, player_t *player, word pn) } //panning page -void panpagemanual(map_view_t *pip, player_t *player, word pn) +void panPageManual(map_view_t *pip, player_t *player, word pn) { switch(player[pn].d) { @@ -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--; } @@ -273,6 +273,38 @@ void panpagemanual(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 *pip, map_t *map, pan_t *pan, global_game_variables_t *gv) +{ + nibble i; + // 1st page + pip[0].page = &gv->video.page[0]; + pip[0].map = map; + pip[0].video = &gv->video; + pip[0].pan = pan; + modexMVInit(pip, 1, 1); + + for(i=1;ivideo.num_of_pages;i++) + { + pip[i].page = &gv->video.page[i]; + pip[i].map = pip[0].map; + pip[i].video = pip[0].video; + pip[i].pan = pip[0].pan; + //pip[i].tx = 1; + //pip[i].ty = 1; + } +} + +void modexMVInit(map_view_t *mv, int tx, int ty) +{ + //mv[0].tx = tx; + //mv[0].ty = ty; + mv[0].tx = mv[1].tx = tx; + mv[0].ty = mv[1].ty = ty; +} + /*map_t allocMap(int w, int h) { map_t result; @@ -365,24 +397,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)); @@ -395,24 +427,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)); @@ -425,24 +457,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); @@ -454,24 +486,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); @@ -548,6 +580,16 @@ void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid) } } +//=========================================================================== +//TODO: put player in starting position of assigned spot on map +//default player position on the viewable map +void playerXYpos(int x, int y, player_t *player, map_view_t *pip, nibble pn) +{ + player[pn].tx = x + pip[0].tx + pip[0].page->tilemidposscreenx; + player[pn].ty = y + pip[0].ty + pip[0].page->tilemidposscreeny; +} +//=========================================================================== + sword chkmap(map_t *map, word q) { // bitmap_t bp; @@ -580,14 +622,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; } @@ -597,15 +645,7 @@ void mapGoTo(map_view_t *mv, int tx, int ty) int py;//px, unsigned int i; - /* 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; - - /* set up the thresholds */ - mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileWidth * 2; - mv[0].dyThresh = mv[1].dyThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileHeight * 2; + mapinitmapview(mv, tx, ty); /* draw the tiles */ modexClearRegion(mv[0].page, 0, 0, mv[0].page->width, mv[0].page->height, 0); @@ -629,6 +669,19 @@ void mapGoTo(map_view_t *mv, int tx, int ty) modexCopyPageRegion(mv[3].page, mv[0].page, 0/**/, 0/**/, 0, 0, 24, 32); } +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; + + /* set up the thresholds */ + mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileWidth * 2; + mv[0].dyThresh = mv[1].dyThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileHeight * 2; +} + void near mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) { @@ -646,11 +699,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)); @@ -658,9 +713,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++) { @@ -671,6 +727,7 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) }*/ break; } +#endif } }