* Fifth Floor, Boston, MA 02110-1301 USA.\r
*\r
*/\r
-//TODO: ADD MEMORY MANAGER! WWWW\r
#include "src/lib/16_map.h"\r
\r
#define DUMP\r
void\r
main(int argc, char *argv[])\r
{\r
+ static global_game_variables_t gvar;\r
map_t map;\r
+ static memptr mapbuf;\r
+#ifdef DUMP_MAP\r
short i;\r
+#endif\r
char *fmt = "Memory available = %u\n";\r
char *fmt0 = "Largest Contiguous Block of Memory available = %u\n";\r
\r
+ MM_Startup(&gvar);\r
+ PM_Startup(&gvar);\r
+ //printf("pmstarted ok\n");\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(&map));\r
+ fprintf(stderr, "Size of map var = %u\n", _msize(&mapbuf));\r
//fprintf(stderr, "program always crashes for some reason....\n");\r
getch();\r
\r
loadmap("data/test.map", &map);\r
+ CA_LoadFile("data/test.map", &mapbuf, &gvar);\r
+ //map=(map_t *)mapbuf;\r
#ifdef DUMP\r
fprintf(stdout, "map.width= %d\n", map.width);\r
fprintf(stdout, "map.height= %d\n", map.height);\r
#ifdef DUMP_MAP\r
- if(map.width*map.height != 1200) exit(-3);\r
+ //if(map.width*map.height != 1200)\r
for(i=0; i<(map.width*map.height); i++)\r
{\r
- fprintf(stdout, "%04d[%02d]", i, map.data[i]);\r
- if(i && !(i%map.width)) fprintf(stdout, "\n");\r
+ //fprintf(stdout, "%04d[%02d]", i, map.data[i]);\r
+ fprintf(stdout, "%c", map.data[i]+44);\r
+ if(!((i+1)%map.width)){ fprintf(stdout, "[%d]", i); fprintf(stdout, "\n"); }\r
}\r
fprintf(stdout, "\n");\r
+ #else\r
+ fprintf(stderr, "contents of the buffer\n[\n%s\n]\n", mapbuf);\r
#endif\r
- fprintf(stdout, "&main()=%Fp\n", *argv[0]);\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);\r
+ fprintf(stdout, "&map.data==%Fp\n", map.data);*/\r
#endif\r
fprintf(stdout, "okies~\n");\r
+ MM_FreePtr(&mapbuf, &gvar);\r
+ PM_Shutdown(&gvar);\r
+ CA_Shutdown(&gvar);\r
+ MM_Shutdown(&gvar);\r
}\r