typedef struct {\r
map_t *map;\r
page_t *page;\r
- int tx; //???? appears to be the tile position on the viewable screen map\r
- int ty; //???? appears to be the tile position on the viewable screen map\r
+ int tx; //appears to be the top left tile position on the viewable screen map\r
+ 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\r
word dxThresh; //????\r
word dyThresh; //????\r
} map_view_t;\r
void mapDrawCol(map_view_t *mv, int tx, int ty, word x);\r
\r
#define TILEWH 16\r
-#define QUADWH (TILEWH/4)\r
+#define QUADWH (TILEWH/4)
+#define SPEED 1
+
+//place holder definitions
+#define MAPX 40
+#define MAPY 30\r
//#define SWAP(a, b) tmp=a; a=b; b=tmp;\r
void main() {\r
// int show1=1;\r
\r
setkb(1);\r
/* create the map */\r
- 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\r
+ 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\r
initMap(&map);\r
- mv.map = ↦\r
+ mv.map = ↦
+
+ //initiate bottem right edge trigger
+// mv.ttx = mv.tx + 20;
+// mv.tty = mv.ty + 15;\r
// mv2.map = ↦\r
\r
/* draw the tiles */\r
screen = modexDefaultPage();\r
screen.width += (TILEWH*2);\r
mv.page = &screen;\r
- mapGoTo(&mv, 16, 16);\r
// screen2=modexNextPage(mv.page);\r
// mv2.page = &screen2;\r
// mapGoTo(&mv2, 16, 16);\r
/* set up paging */\r
// show = &mv;\r
// draw = &mv2;\r
- draw = &mv;\r
+ draw = &mv;
+
+ mapGoTo(draw, 0, 0);\r
\r
//TODO: set player position data here according to the viewable map screen thingy\r
-\r
+
+ modexShowPage(draw->page);\r
while(!keyp(1)) {\r
//TODO: top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square\r
//to stop scrolling and have the player position data move to the edge of the screen with respect to the direction\r
//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\r
- if(keyp(77)){\r
-// for(q=0; q<TILEWH; q++) {\r
- mapScrollRight(draw, 1);\r
-// modexShowPage(draw->page);\r
+ if(keyp(77)){
+ if(draw->tx >= 0 && draw->tx+20 < MAPX)\r
+ for(q=0; q<16; q++) {\r
+ mapScrollRight(draw, SPEED);\r
+ modexShowPage(draw->page);\r
// mapScrollRight(draw, 1);\r
// SWAP(draw, show);\r
-// }\r
+ }
+\r
}\r
\r
- if(keyp(75)){\r
-// for(q=0; q<TILEWH; q++) {\r
- mapScrollLeft(draw, 1);\r
-// modexShowPage(draw->page);\r
+ if(keyp(75)){
+ if(draw->tx > 0 && draw->tx+20 <= MAPX)\r
+ for(q=0; q<16; q++) {\r
+ mapScrollLeft(draw, SPEED);\r
+ modexShowPage(draw->page);\r
// mapScrollLeft(show, 1);\r
// SWAP(draw, show);\r
-// }\r
+ }\r
+
}\r
\r
- if(keyp(80)){\r
-// for(q=0; q<TILEWH; q++) {\r
- mapScrollDown(draw, 1);\r
-// modexShowPage(draw->page);\r
+ if(keyp(80)){
+ if(draw->ty >= 0 && draw->ty+15 < MAPY)\r
+ for(q=0; q<16; q++) {\r
+ mapScrollDown(draw, SPEED);\r
+ modexShowPage(draw->page);\r
// mapScrollDown(show, 1);\r
// SWAP(draw, show);\r
-// }\r
+ }
+\r
}\r
\r
- if(keyp(72)){\r
-// for(q=0; q<TILEWH; q++) {\r
- mapScrollUp(draw, 1);\r
-// modexShowPage(draw->page);\r
+ if(keyp(72)){
+ if(draw->ty > 0 && draw->ty+15 <= MAPY)\r
+ for(q=0; q<16; q++) {\r
+ mapScrollUp(draw, SPEED);\r
+ modexShowPage(draw->page);\r
// mapScrollUp(show, 1);\r
// SWAP(draw, show);\r
-// }\r
+ }
+\r
}\r
\r
//keyp(ch);\r
- modexShowPage(draw->page);\r
+ //modexShowPage(draw->page);\r
\r
}\r
-\r
+
modexLeave();\r
- setkb(0);\r
+ 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);
}\r
\r
\r