X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=16%2Fmodex16%2Fscroll.c;h=8a960eee044d8c229344308a6c4e8dea79acb4c4;hb=ff7ba1d826146a17e98811064334aab9bf2c9a47;hp=55e2fe9465d205d90c21a657d43cafd3c10281d1;hpb=fff2b90efe4103d1fd4212a7e7c7964addc0b706;p=16.git diff --git a/16/modex16/scroll.c b/16/modex16/scroll.c old mode 100644 new mode 100755 index 55e2fe94..8a960eee --- a/16/modex16/scroll.c +++ b/16/modex16/scroll.c @@ -26,10 +26,8 @@ typedef struct { typedef struct { map_t *map; page_t *page; - int tx; //appears to be the top left tile position on the viewable screen map - int ty; //appears to be the top left tile position on the viewable screen map -// int ttx; //bottem right tile -// int tty; //bottem left tile + int tx; //???? appears to be the tile position on the viewable screen map + int ty; //???? appears to be the tile position on the viewable screen map word dxThresh; //???? word dyThresh; //???? } map_view_t; @@ -52,12 +50,7 @@ void mapDrawRow(map_view_t *mv, int tx, int ty, word y); void mapDrawCol(map_view_t *mv, int tx, int ty, word x); #define TILEWH 16 -#define QUADWH (TILEWH/4) -#define SPEED 2 - -//place holder definitions -#define MAPX 40 -#define MAPY 30 +#define QUADWH (TILEWH/4) //#define SWAP(a, b) tmp=a; a=b; b=tmp; void main() { // int show1=1; @@ -78,13 +71,9 @@ void main() { 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(160,120); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly initMap(&map); - mv.map = ↦ - - //initiate bottem right edge trigger -// mv.ttx = mv.tx + 20; -// mv.tty = mv.ty + 15; + mv.map = ↦ // mv2.map = ↦ /* draw the tiles */ @@ -93,6 +82,7 @@ void main() { screen = modexDefaultPage(); screen.width += (TILEWH*2); mv.page = &screen; + mapGoTo(&mv, 16, 16); // screen2=modexNextPage(mv.page); // mv2.page = &screen2; // mapGoTo(&mv2, 16, 16); @@ -101,73 +91,57 @@ void main() { /* set up paging */ // show = &mv; // draw = &mv2; - draw = &mv; - - mapGoTo(draw, 0, 0); + draw = &mv; //TODO: set player position data here according to the viewable map screen thingy - - modexShowPage(draw->page); + while(!keyp(1)) { //TODO: top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square //to stop scrolling and have the player position data move to the edge of the screen with respect to the direction //when player.tx or player.ty == 0 or player.tx == 20 or player.ty == 15 then stop because that is edge of map and you do not want to walk of the map - if(keyp(77)){ - if(draw->tx >= 0 && draw->tx+20 < MAPX) - for(q=0; q<(TILEWH/SPEED); q++) { - mapScrollRight(draw, SPEED); - modexShowPage(draw->page); + if(keyp(77)){ +// for(q=0; qpage); // mapScrollRight(draw, 1); // SWAP(draw, show); - } - +// } } - if(keyp(75)){ - if(draw->tx > 0 && draw->tx+20 <= MAPX) - for(q=0; q<(TILEWH/SPEED); q++) { - mapScrollLeft(draw, SPEED); - modexShowPage(draw->page); + if(keyp(75)){ +// for(q=0; qpage); // mapScrollLeft(show, 1); // SWAP(draw, show); - } - +// } } - if(keyp(80)){ - if(draw->ty >= 0 && draw->ty+15 < MAPY) - for(q=0; q<(TILEWH/SPEED); q++) { - mapScrollDown(draw, SPEED); - modexShowPage(draw->page); + if(keyp(80)){ +// for(q=0; qpage); // mapScrollDown(show, 1); // SWAP(draw, show); - } - +// } } - if(keyp(72)){ - if(draw->ty > 0 && draw->ty+15 <= MAPY) - for(q=0; q<(TILEWH/SPEED); q++) { - mapScrollUp(draw, SPEED); - modexShowPage(draw->page); + if(keyp(72)){ +// for(q=0; qpage); // mapScrollUp(show, 1); // SWAP(draw, show); - } - +// } } //keyp(ch); - //modexShowPage(draw->page); + modexShowPage(draw->page); } - + modexLeave(); - setkb(0); - printf("Project 16 scroll.exe\n"); - printf("tx: %d\n", draw->tx); - printf("ty: %d\n", draw->ty); - //printf("ttx: %d\n", draw->ttx); - //printf("tty: %d\n", draw->tty); + setkb(0); }