]> 4ch.mooo.com Git - 16.git/blobdiff - src/maptest.c
[xcroll.exe needs testing on real hardware] it is working but not flexible 16_ca...
[16.git] / src / maptest.c
old mode 100644 (file)
new mode 100755 (executable)
index 0b045e3..33c5dcc
@@ -1,29 +1,89 @@
-#include "src/lib/mapread.h"\r
-
-#define DUMP
-#define DUMP_MAP
-
-void
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+#include "src/lib/16_map.h"\r
+#include <malloc.h>\r
+\r
+#define DUMP\r
+//#define DUMP_MAP\r
+\r
+void\r
 main(int argc, char *argv[])\r
 {\r
-       map_t map;
-       short i;
-       loadmap("data/test.map", &map);
-       #ifdef DUMP
-       fprintf(stdout, "map.width=     %d\n", map.width);
-       fprintf(stdout, "map.height=    %d\n", map.height);
-       #ifdef DUMP_MAP
-       for(i=0; i<(map.width*map.height); i++)
-       {
-               fprintf(stdout, "%04d[%02d]", i, map.data[i]);
-               if(i && !(i%map.width)) fprintf(stdout, "\n");
-       }
-       fprintf(stdout, "\n");
-       #endif
-       fprintf(stdout, "&map==%Fp\n", &map);
-       fprintf(stdout, "&map.tiles==%Fp\n", map.tiles);
-       fprintf(stdout, "&map.width==%Fp\n", map.width);
+       static global_game_variables_t gvar;\r
+       static map_t map;\r
+#ifdef DUMP\r
+#ifdef DUMP_MAP\r
+       short i;\r
+       word k;\r
+#endif\r
+#endif\r
+       char *fmt = "Memory available = %u\n";\r
+       char *fmt0 = "Largest Contiguous Block of Memory available = %u\n";\r
+       //byte *datboi = "oh shit waddup!\n";\r
+\r
+       MM_Startup(&gvar);\r
+       PM_Startup(&gvar);\r
+       PM_CheckMainMem(&gvar);\r
+       PM_UnlockMainMem(&gvar);\r
+       CA_Startup(&gvar);\r
+\r
+       fprintf(stderr, fmt, _memavl());\r
+       fprintf(stderr, fmt0, _memmax());\r
+       fprintf(stderr, "Size of map var = %u\n", _msize(&(gvar.ca.MAPSEGPTR)));\r
+\r
+       CA_loadmap("data/test.map", &map, &gvar);\r
+#ifdef DUMP\r
+       fprintf(stdout, "map.width=     %d\n", map.width);\r
+       fprintf(stdout, "map.height=    %d\n", map.height);\r
+       getch();\r
+#ifdef DUMP_MAP\r
+       for(k=0;k<MAPPLANES;k++)\r
+       {\r
+               printf("maplayer: %u\n[\n", k);\r
+               for(i=0; i<(map.width*map.height); i++)\r
+               {\r
+                       //fprintf(stdout, "%04d[%02d]", i, map.data[i]);\r
+                       //fprintf(stdout, "%c", map.MAPDATAPTK[i]+44);\r
+                       fprintf(stdout, "%c", map.layerdata[k].data[i]+44);\r
+                       if(!((i+1)%map.width)){\r
+                               //fprintf(stdout, "[%d]", i);\r
+                               fprintf(stdout, "\n"); }\r
+               }\r
+               fprintf(stdout, "]\n");\r
+               getch();\r
+       }\r
+#else\r
+       fprintf(stderr, "contents of the buffer\n[\n%s\n]\n", (gvar.ca.MAPSEGPTR));\r
+#endif\r
+       /*fprintf(stdout, "&main()=%Fp\n", *argv[0]);\r
+       fprintf(stdout, "&map==%Fp\n", &map);\r
+       fprintf(stdout, "&map.tiles==%Fp\n", map.tiles);\r
+       fprintf(stdout, "&map.width==%Fp\n", map.width);\r
        fprintf(stdout, "&map.height==%Fp\n", map.height);\r
-       fprintf(stdout, "&map.data==%Fp\n", map.data);
-       #endif
+       fprintf(stdout, "&map.data==%Fp\n", map.data);*/\r
+#endif\r
+       //fprintf(stderr, "here comes dat boi!\n"); getch(); fprintf(stderr, "%s", datboi);\r
+       MM_FreePtr(MEMPTRCONV (gvar.ca.MAPSEGPTR), &gvar);\r
+       PM_Shutdown(&gvar);\r
+       CA_Shutdown(&gvar);\r
+       MM_Shutdown(&gvar);\r
 }\r