From: sparky4 Date: Sat, 22 Nov 2014 15:14:58 +0000 (-0600) Subject: modified: 16/modex16/scroll.c X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=7872dbf5d0240f01177588bd7966c3e042ced554;p=16.git modified: 16/modex16/scroll.c modified: 16/modex16/scroll.exe made it use less memory --- diff --git a/16/modex16/scroll.c b/16/modex16/scroll.c index 14aec257..8a960eee 100644 --- a/16/modex16/scroll.c +++ b/16/modex16/scroll.c @@ -10,7 +10,7 @@ typedef struct { word tileHeight; word tileWidth; unsigned int rows; - unsigned int cols; + unsigned int cols; unsigned int tilex,tiley; // tile position on the map } tiles_t; @@ -48,24 +48,25 @@ void mapGoTo(map_view_t *mv, int tx, int ty); void mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y); 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 TILEWH 16 #define QUADWH (TILEWH/4) -#define SWAP(a, b) tmp=a; a=b; b=tmp; +//#define SWAP(a, b) tmp=a; a=b; b=tmp; void main() { - int show1=1; +// int show1=1; int tx, ty; int x, y; //int ch=0x0; - byte ch; +// byte ch; int q=0; - page_t screen,screen2; + page_t screen;//,screen2; map_t map; - map_view_t mv, mv2; - map_view_t *draw, *show, *tmp; - byte *ptr; + map_view_t mv;//, mv2; + map_view_t *draw;//, *show, *tmp; + byte *ptr; + //default player position on the viewable map - player.tx = 10; + player.tx = 10; player.ty = 8; setkb(1); @@ -73,7 +74,7 @@ void main() { 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 = ↦ - mv2.map = ↦ +// mv2.map = ↦ /* draw the tiles */ ptr = map.data; @@ -82,20 +83,21 @@ void main() { screen.width += (TILEWH*2); mv.page = &screen; mapGoTo(&mv, 16, 16); - screen2=modexNextPage(mv.page); - mv2.page = &screen2; - mapGoTo(&mv2, 16, 16); - modexShowPage(mv.page); - +// screen2=modexNextPage(mv.page); +// mv2.page = &screen2; +// mapGoTo(&mv2, 16, 16); +// modexShowPage(mv.page); + /* set up paging */ - show = &mv; - draw = &mv2; - - //TODO: set player position data here according to the viewable map screen thingy - - 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 +// show = &mv; +// draw = &mv2; + draw = &mv; + + //TODO: set player position data here according to the viewable map screen thingy + + 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)){ // for(q=0; qpage); } diff --git a/16/modex16/scroll.exe b/16/modex16/scroll.exe index af659045..23762520 100755 Binary files a/16/modex16/scroll.exe and b/16/modex16/scroll.exe differ