=\r
======================\r
*/\r
-/*++++\r
-void CA_SetGrPurge (void)\r
+\r
+void CA_SetGrPurge (global_game_variables_t *gvar)\r
{\r
int i;\r
\r
//\r
// free graphics\r
//\r
- CA_ClearMarks ();\r
+ CA_ClearMarks (gvar);\r
\r
for (i=0;i<NUMCHUNKS;i++)\r
- if (grsegs[i])\r
- MM_SetPurge (&(memptr)grsegs[i],3);\r
+ if (gvar->ca.grsegs[i])\r
+ MM_SetPurge (gvar->ca.grsegs[i],3, gvar);\r
}\r
-*/\r
+\r
\r
/*\r
======================\r
=\r
======================\r
*/\r
-/*++++++++\r
-void CA_SetAllPurge (void)\r
+\r
+void CA_SetAllPurge (global_game_variables_t *gvar)\r
{\r
int i;\r
\r
- CA_ClearMarks ();\r
+ CA_ClearMarks (gvar);\r
\r
//\r
// free cursor sprite and background save\r
//\r
// free map headers and map planes\r
//\r
- for (i=0;i<NUMMAPS;i++)\r
- if (mapheaderseg[i])\r
- MM_SetPurge (&(memptr)mapheaderseg[i],3);\r
+// for (i=0;i<NUMMAPS;i++)\r
+// if (gvar->ca.camap.mapheaderseg[i])\r
+// MM_SetPurge (gvar->ca.camap.mapheaderseg[i],3, gvar);\r
\r
for (i=0;i<3;i++)\r
- if (mapsegs[i])\r
- MM_FreePtr (&(memptr)mapsegs[i]);\r
+ if (gvar->ca.mapsegs[i])\r
+ MM_FreePtr (gvar->ca.mapsegs[i], gvar);\r
\r
//\r
// free sounds\r
//\r
for (i=0;i<NUMSNDCHUNKS;i++)\r
- if (audiosegs[i])\r
- MM_SetPurge (&(memptr)audiosegs[i],3);\r
+ if (gvar->ca.audiosegs[i])\r
+ MM_SetPurge (gvar->ca.audiosegs[i],3, gvar);\r
\r
//\r
// free graphics\r
//\r
- CA_SetGrPurge ();\r
-}*/\r
+ CA_SetGrPurge (gvar);\r
+}\r
\r
\r
//===========================================================================\r
//void CA_LoadAllSounds (void);\r
\r
/*void CA_UpLevel (void);\r
-void CA_DownLevel (void);\r
+void CA_DownLevel (void);*/\r
\r
-void CA_SetGrPurge (void);\r
-void CA_SetAllPurge (void);*/\r
+void CA_SetGrPurge (global_game_variables_t *gvar);\r
+void CA_SetAllPurge (global_game_variables_t *gvar);\r
\r
void CA_ClearMarks (global_game_variables_t *gvar);\r
void CA_ClearAllMarks (global_game_variables_t *gvar);\r
//======\r
\r
\r
-#define MAPBUFINLM (gvar->ca.camap.mapsegs)\r
+#define MAPBUFINLM *(gvar->ca.mapsegs)\r
int CA_loadmap(char *mn, map_t *map, global_game_variables_t *gvar)\r
{\r
jsmn_parser p;\r
\r
#define NUMMAPS 4//39\r
#define MAPPLANES 3\r
+#define NUMSNDCHUNKS 84\r
\r
typedef struct\r
{\r
typedef struct\r
{\r
int mapon, mapnum;\r
- //__SEGA *mapsegs[4];\r
//__SEGA *mapheaderseg[NUMMAPS];\r
- //__SEGA *tinf;\r
- memptr mapsegs;\r
} ca_mapinfo_t;\r
\r
typedef struct\r
{\r
int maphandle[4]; // handle to MAPTEMP / GAMEMAPS\r
+ int grhandle[4]; // handle to EGAGRAPH\r
+ int audiohandle[4]; // handle to AUDIOT / AUDIO\r
} ca_handle_t;\r
\r
typedef struct\r
{\r
- byte ca_levelbit,ca_levelnum;\r
- ca_handle_t file; //files to open\r
+ byte ca_levelbit,ca_levelnum;\r
+ ca_handle_t file; //files to open\r
ca_mapinfo_t camap;\r
- __SEGA *grsegs[NUMCHUNKS];\r
- byte far grneeded[NUMCHUNKS];\r
+\r
+ memptr/*__SEGA*/ mapsegs[MAP_LAYERS];\r
+ memptr/*__SEGA*/ *grsegs[NUMCHUNKS];\r
+ byte far grneeded[NUMCHUNKS];\r
+ memptr/*byte _seg*/ *audiosegs[NUMSNDCHUNKS];\r
+\r
huffnode huffnode;\r
\r
//TODO: extend! and learn from keen/wolf/catacomb's code wwww\r
\r
fprintf(stderr, fmt, _memavl());\r
fprintf(stderr, fmt0, _memmax());\r
- fprintf(stderr, "Size of map var = %u\n", _msize(&(gvar.ca.camap.mapsegs)));\r
+ fprintf(stderr, "Size of map var = %u\n", _msize(&(gvar.ca.mapsegs)));\r
//getch();\r
\r
CA_loadmap("data/test.map", &map, &gvar);\r
getch();\r
}\r
#else\r
- //fprintf(stderr, "contents of the buffer\n[\n%s\n]\n", (gvar.ca.camap.mapsegs));\r
+ //fprintf(stderr, "contents of the buffer\n[\n%s\n]\n", (gvar.ca.mapsegs));\r
#endif\r
/*fprintf(stdout, "&main()=%Fp\n", *argv[0]);\r
fprintf(stdout, "&map==%Fp\n", &map);\r
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(&(gvar.ca.camap.mapsegs), &gvar);\r
+ MM_FreePtr(&(gvar.ca.mapsegs), &gvar);\r
PM_Shutdown(&gvar);\r
CA_Shutdown(&gvar);\r
MM_Shutdown(&gvar);\r