From 927f7b271d3a2926bbd654f4782a529c7e058ee3 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Mon, 20 Feb 2017 08:54:26 -0600 Subject: [PATCH] 16_ca need to be used more --- MEMINFO.16W | 0 src/lib/16_ca.c | 36 ++++++++++++++++++------------------ src/lib/16_ca.h | 6 +++--- src/lib/16_map.c | 2 +- src/lib/16_tdef.h | 18 +++++++++++------- src/maptest.c | 6 +++--- 6 files changed, 36 insertions(+), 32 deletions(-) create mode 100755 MEMINFO.16W diff --git a/MEMINFO.16W b/MEMINFO.16W new file mode 100755 index 00000000..e69de29b diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index dcdcaa1c..9e984899 100755 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -2034,21 +2034,21 @@ void CA_ClearAllMarks (global_game_variables_t *gvar) = ====================== */ -/*++++ -void CA_SetGrPurge (void) + +void CA_SetGrPurge (global_game_variables_t *gvar) { int i; // // free graphics // - CA_ClearMarks (); + CA_ClearMarks (gvar); for (i=0;ica.grsegs[i]) + MM_SetPurge (gvar->ca.grsegs[i],3, gvar); } -*/ + /* ====================== @@ -2059,12 +2059,12 @@ void CA_SetGrPurge (void) = ====================== */ -/*++++++++ -void CA_SetAllPurge (void) + +void CA_SetAllPurge (global_game_variables_t *gvar) { int i; - CA_ClearMarks (); + CA_ClearMarks (gvar); // // free cursor sprite and background save @@ -2074,26 +2074,26 @@ void CA_SetAllPurge (void) // // free map headers and map planes // - for (i=0;ica.camap.mapheaderseg[i]) +// MM_SetPurge (gvar->ca.camap.mapheaderseg[i],3, gvar); for (i=0;i<3;i++) - if (mapsegs[i]) - MM_FreePtr (&(memptr)mapsegs[i]); + if (gvar->ca.mapsegs[i]) + MM_FreePtr (gvar->ca.mapsegs[i], gvar); // // free sounds // for (i=0;ica.audiosegs[i]) + MM_SetPurge (gvar->ca.audiosegs[i],3, gvar); // // free graphics // - CA_SetGrPurge (); -}*/ + CA_SetGrPurge (gvar); +} //=========================================================================== diff --git a/src/lib/16_ca.h b/src/lib/16_ca.h index 471a4517..6e4933cb 100755 --- a/src/lib/16_ca.h +++ b/src/lib/16_ca.h @@ -108,10 +108,10 @@ void CA_Shutdown (global_game_variables_t *gvar); //void CA_LoadAllSounds (void); /*void CA_UpLevel (void); -void CA_DownLevel (void); +void CA_DownLevel (void);*/ -void CA_SetGrPurge (void); -void CA_SetAllPurge (void);*/ +void CA_SetGrPurge (global_game_variables_t *gvar); +void CA_SetAllPurge (global_game_variables_t *gvar); void CA_ClearMarks (global_game_variables_t *gvar); void CA_ClearAllMarks (global_game_variables_t *gvar); diff --git a/src/lib/16_map.c b/src/lib/16_map.c index 26167781..946c809a 100755 --- a/src/lib/16_map.c +++ b/src/lib/16_map.c @@ -213,7 +213,7 @@ int newloadmap(char *mn, map_t *map) { //====== -#define MAPBUFINLM (gvar->ca.camap.mapsegs) +#define MAPBUFINLM *(gvar->ca.mapsegs) int CA_loadmap(char *mn, map_t *map, global_game_variables_t *gvar) { jsmn_parser p; diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 5621be81..cf5f56eb 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -507,6 +507,7 @@ typedef struct #define NUMMAPS 4//39 #define MAPPLANES 3 +#define NUMSNDCHUNKS 84 typedef struct { @@ -516,24 +517,27 @@ typedef struct typedef struct { int mapon, mapnum; - //__SEGA *mapsegs[4]; //__SEGA *mapheaderseg[NUMMAPS]; - //__SEGA *tinf; - memptr mapsegs; } ca_mapinfo_t; typedef struct { int maphandle[4]; // handle to MAPTEMP / GAMEMAPS + int grhandle[4]; // handle to EGAGRAPH + int audiohandle[4]; // handle to AUDIOT / AUDIO } ca_handle_t; typedef struct { - byte ca_levelbit,ca_levelnum; - ca_handle_t file; //files to open + byte ca_levelbit,ca_levelnum; + ca_handle_t file; //files to open ca_mapinfo_t camap; - __SEGA *grsegs[NUMCHUNKS]; - byte far grneeded[NUMCHUNKS]; + + memptr/*__SEGA*/ mapsegs[MAP_LAYERS]; + memptr/*__SEGA*/ *grsegs[NUMCHUNKS]; + byte far grneeded[NUMCHUNKS]; + memptr/*byte _seg*/ *audiosegs[NUMSNDCHUNKS]; + huffnode huffnode; //TODO: extend! and learn from keen/wolf/catacomb's code wwww diff --git a/src/maptest.c b/src/maptest.c index 11097deb..e8e2d53c 100755 --- a/src/maptest.c +++ b/src/maptest.c @@ -48,7 +48,7 @@ main(int argc, char *argv[]) fprintf(stderr, fmt, _memavl()); fprintf(stderr, fmt0, _memmax()); - fprintf(stderr, "Size of map var = %u\n", _msize(&(gvar.ca.camap.mapsegs))); + fprintf(stderr, "Size of map var = %u\n", _msize(&(gvar.ca.mapsegs))); //getch(); CA_loadmap("data/test.map", &map, &gvar); @@ -74,7 +74,7 @@ main(int argc, char *argv[]) getch(); } #else - //fprintf(stderr, "contents of the buffer\n[\n%s\n]\n", (gvar.ca.camap.mapsegs)); + //fprintf(stderr, "contents of the buffer\n[\n%s\n]\n", (gvar.ca.mapsegs)); #endif /*fprintf(stdout, "&main()=%Fp\n", *argv[0]); fprintf(stdout, "&map==%Fp\n", &map); @@ -84,7 +84,7 @@ main(int argc, char *argv[]) fprintf(stdout, "&map.data==%Fp\n", map.data);*/ #endif //fprintf(stderr, "here comes dat boi!\n"); getch(); fprintf(stderr, "%s", datboi); - MM_FreePtr(&(gvar.ca.camap.mapsegs), &gvar); + MM_FreePtr(&(gvar.ca.mapsegs), &gvar); PM_Shutdown(&gvar); CA_Shutdown(&gvar); MM_Shutdown(&gvar); -- 2.39.5