OSDN Git Service

modified: 16/modex16/scroll.c
authorsparky4 <sparky4@cock.li>
Fri, 21 Nov 2014 03:03:20 +0000 (21:03 -0600)
committersparky4 <sparky4@cock.li>
Fri, 21 Nov 2014 03:03:20 +0000 (21:03 -0600)
modified:   16/modex16/scroll.exe
added /TODO:

16/modex16/scroll.c
16/modex16/scroll.exe

index 6cf3c9d..14aec25 100644 (file)
@@ -10,7 +10,8 @@ typedef struct {
        word tileHeight;\r
        word tileWidth;\r
        unsigned int rows;\r
-       unsigned int cols;\r
+       unsigned int cols;
+       unsigned int tilex,tiley; // tile position on the map\r
 } tiles_t;\r
 \r
 \r
@@ -25,15 +26,15 @@ typedef struct {
 typedef struct {\r
        map_t *map;\r
        page_t *page;\r
-       int tx;\r
-       int ty;\r
-       word dxThresh;\r
-       word dyThresh;\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
+       word dxThresh; //????\r
+       word dyThresh; //????\r
 } map_view_t;\r
 \r
 struct {\r
-       int tilex;\r
-       int tiley;\r
+       int tx; //player position on the viewable map\r
+       int ty; //player position on the viewable map\r
 } player;\r
 \r
 \r
@@ -64,12 +65,12 @@ void main() {
        map_view_t *draw, *show, *tmp;\r
        byte *ptr;
        //default player position on the viewable map\r
-       player.tilex = 10;
-       player.tiley = 8;\r
+       player.tx = 10;
+       player.ty = 8;\r
 \r
        setkb(1);\r
        /* create the map */\r
-       map = allocMap(40,30); //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(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
        initMap(&map);\r
        mv.map = &map;\r
        mv2.map = &map;\r
@@ -80,17 +81,22 @@ void main() {
        screen = modexDefaultPage();\r
        screen.width += (TILEWH*2);\r
        mv.page = &screen;\r
-       mapGoTo(&mv, 0, 0);\r
+       mapGoTo(&mv, 16, 16);\r
        screen2=modexNextPage(mv.page);\r
        mv2.page = &screen2;\r
-       mapGoTo(&mv2, 0, 0);\r
-       modexShowPage(mv.page);\r
-\r
+       mapGoTo(&mv2, 16, 16);\r
+       modexShowPage(mv.page);
+
        /* set up paging */\r
        show = &mv;\r
        draw = &mv2;\r
+
+       //TODO: set player position data here according to the viewable map screen thingy
 \r
-       while(!keyp(1)) {\r
+       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\r
        if(keyp(77)){\r
 //             for(q=0; q<TILEWH; q++) {\r
                mapScrollRight(draw, 1);\r
index 97cc90f..af65904 100755 (executable)
Binary files a/16/modex16/scroll.exe and b/16/modex16/scroll.exe differ