]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/scroll16.c
added stuff to help me study 0.exe it is a complex program wwww what is getting to...
[16.git] / src / lib / scroll16.c
index b8ef85201ab996f6c551cc967d1d41e9f1f305e5..112610c98d324923af851f6d1e76d1f395367070 100755 (executable)
@@ -214,7 +214,7 @@ void walk(map_view_t *pip, player_t *player, word pn)
 }\r
 \r
 //panning page\r
-void panpagemanual(map_view_t *pip, player_t *player, word pn)\r
+void panPageManual(map_view_t *pip, player_t *player, word pn)\r
 {\r
        switch(player[pn].d)\r
        {\r
@@ -273,6 +273,66 @@ 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);\r
 }\r
 \r
+//panning vmem\r
+void panVmemManual(map_view_t *pip, player_t *player, word pn)\r
+{\r
+       switch(player[pn].d)\r
+       {\r
+               //right movement\r
+               case 3:\r
+                       if(pip[pip[0].pan->pn].tx >= 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw < pip[pip[0].pan->pn].page->tilesw)\r
+                       {\r
+                               if(player[pn].q<=player[pn].spt)\r
+                               {\r
+                                       pip[pip[0].pan->pn].page->dx+=4;\r
+                                       modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+                                       player[pn].q++;\r
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; }\r
+                       }\r
+               break;\r
+\r
+               //left movement\r
+               case 1:\r
+                       if(pip[pip[0].pan->pn].tx > 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw <= pip[pip[0].pan->pn].page->tilesw)\r
+                       {\r
+                               if(player[pn].q<=player[pn].spt)\r
+                               {\r
+                                       pip[pip[0].pan->pn].page->dx-=4;\r
+                                       modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+                                       player[pn].q++;\r
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; }\r
+                       }\r
+               break;\r
+\r
+               //down movement\r
+               case 4:\r
+                       if(pip[pip[0].pan->pn].ty >= 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th < pip[pip[0].pan->pn].page->tilesh+pip[pip[1].pan->pn].page->tilesh)//+pip[pip[2].pan->pn].page->tilesh+pip[pip[3].pan->pn].page->tilesh)\r
+                       {\r
+                               if(player[pn].q<=player[pn].spt)\r
+                               {\r
+                                       pip[pip[0].pan->pn].page->dy+=4;\r
+                                       modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+                                       player[pn].q++;\r
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; }\r
+                       }\r
+               break;\r
+\r
+               //up movement\r
+               case 0:\r
+                       if(pip[pip[0].pan->pn].ty > 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th <= pip[pip[0].pan->pn].page->tilesh+pip[pip[1].pan->pn].page->tilesh)//+pip[pip[2].pan->pn].page->tilesh+pip[pip[3].pan->pn].page->tilesh)\r
+                       {\r
+                               if(player[pn].q<=player[pn].spt)\r
+                               {\r
+                                       pip[pip[0].pan->pn].page->dy-=4;\r
+                                       modexShowPageVsync(pip[pip[0].pan->pn].page);\r
+                                       player[pn].q++;\r
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; }\r
+                       }\r
+                       break;\r
+       }\r
+       //if (player[pn].d!=2) printf("player[%u].d=%u player[%u].q=%u\n", pn, player[pn].d, pn, player[pn].q);\r
+}\r
+\r
 /*map_t\r
 allocMap(int w, int h) {\r
        map_t result;\r
@@ -597,15 +657,7 @@ void mapGoTo(map_view_t *mv, int tx, int ty)
        int py;//px,\r
        unsigned int i;\r
 \r
-       /* set up the coordinates */\r
-       mv[0].tx = mv[1].tx = tx;\r
-       mv[0].ty = mv[1].ty = ty;\r
-       mv[0].page->dx = mv[1].page->dx = mv[2].page->dx = mv[3].page->dx = mv->map->tiles->tileWidth;\r
-       mv[0].page->dy = mv[1].page->dy = mv[2].page->dy = mv[3].page->dy = mv->map->tiles->tileHeight;\r
-\r
-       /* set up the thresholds */\r
-       mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileWidth * 2;\r
-       mv[0].dyThresh = mv[1].dyThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileHeight * 2;\r
+       mapinitmapview(mv, tx, ty);\r
 \r
        /* draw the tiles */\r
        modexClearRegion(mv[0].page, 0, 0, mv[0].page->width, mv[0].page->height, 0);\r
@@ -629,11 +681,8 @@ void mapGoTo(map_view_t *mv, int tx, int ty)
        modexCopyPageRegion(mv[3].page, mv[0].page, 0/**/, 0/**/, 0, 0, 24, 32);\r
 }\r
 \r
-void mapGoTo_(map_view_t *mv, int tx, int ty)\r
+void mapinitmapview(map_view_t *mv, int tx, int ty)\r
 {\r
-       int py;\r
-       unsigned int i;\r
-\r
        /* set up the coordinates */\r
        mv[0].tx = mv[1].tx = tx;\r
        mv[0].ty = mv[1].ty = ty;\r
@@ -643,27 +692,6 @@ void mapGoTo_(map_view_t *mv, int tx, int ty)
        /* set up the thresholds */\r
        mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileWidth * 2;\r
        mv[0].dyThresh = mv[1].dyThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileHeight * 2;\r
-\r
-       /* draw the tiles */\r
-       modexClearRegion(mv[0].page, 0, 0, mv[0].page->width, mv[0].page->height, 0);\r
-       py=0;\r
-       i=mv[0].ty * mv[0].map->width + mv[0].tx;\r
-       for(ty=mv[0].ty-1; py < mv[0].page->sh+mv->dyThresh && ty < mv[0].map->height; ty++, py+=mv[0].map->tiles->tileHeight) {\r
-               mapDrawWRow(&mv[0], tx-1, ty, py);\r
-       i+=mv->map->width - tx;\r
-       }\r
-       if(!pageploop) modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height);\r
-//     {\r
-//             unsigned int k,j,o;\r
-//             /* fill screen with a distinctive pattern */\r
-//             for (k=0;k < vga_state.vga_width;k++) {\r
-//                     o = k >> 2;\r
-//                     vga_write_sequencer(0x02/*map mask*/,1 << (k&3));\r
-//                             for (j=0;j < (mv[0].page->height)+(mv[1].page->height)+(mv[2].page->height)+(mv[3].page->height);j++,o += vga_state.vga_stride)\r
-//                                     vga_state.vga_graphics_ram[o] = (k^j)&15; // VRL samples put all colors in first 15!\r
-//             }\r
-//     }\r
-       modexCopyPageRegion(mv[3].page, mv[0].page, 0/**/, 0/**/, 0, 0, 24, 32);\r
 }\r
 \r
 void near\r