From 2f9b9da25eb21b1945419758cff38824ed63e49b Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 8 Sep 2016 10:11:33 -0500 Subject: [PATCH] wwww yakuji wwww ca use to load maps w hmmm cachemap wwww --- src/lib/16_ca.c | 18 +++++++++--------- src/lib/typdefst.h | 11 ++++++++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index ec62a170..6511ef17 100755 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -1834,26 +1834,26 @@ void CA_CacheMap (global_game_variables_t *gvar) // // free up memory from last map // - if (mapon>-1 && mapheaderseg[gvar->ca.mapon]) - MM_SetPurge (&(memptr)mapheaderseg[gvar-ca.mapon],3); +// if (gvar->ca.map.mapon>-1 && gvar->ca.map.mapheaderseg[gvar->ca.map.mapon]) +// MM_SetPurge (&(memptr)gvar->ca.map.mapheaderseg[gvar-ca.map.mapon],3); for (plane=0;planeca.map.mapsegs[plane]) + MM_FreePtr (&(memptr)gvar->ca.map.mapsegs[plane]); - mapon = mapnum; + gvar->ca.map.mapon = gvar->ca.map.mapnum; // // load map header // The header will be cached if it is still around // - if (!mapheaderseg[mapnum]) + if (!gvar->ca.map.mapheaderseg[gvar->ca.map.mapnum]) { - pos = ((mapfiletype _seg *)tinf)->headeroffsets[mapnum]; + pos = ((__segmement *)tinf)->headeroffsets[gvar->ca.mapnum]; if (pos<0) // $FFFFFFFF start is a sparse map - Quit ("CA_CacheMap: Tried to load a non existent map!"); + printf("CA_CacheMap: Tried to load a non existent map!"); - MM_GetPtr(&(memptr)mapheaderseg[mapnum],sizeof(maptype)); + MM_GetPtr(&(memptr)gvar->ca.mapheaderseg[mapnum],sizeof(maptype)); lseek(maphandle,pos,SEEK_SET); CA_FarRead (maphandle,(memptr)mapheaderseg[mapnum],sizeof(maptype)); } diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index eedbfc9d..02c1df1a 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -183,6 +183,15 @@ typedef struct //from 16_ca //========================================================================== +#define NUMMAPS 4//39 +#define MAPPLANES 3 + +typedef struct +{ + __segment *mapsegs[4]; + __segment *mapheaderseg[NUMMAPS]; +} mapinfo_t; + typedef struct { int maphandle[4]; // handle to MAPTEMP / GAMEMAPS @@ -193,7 +202,7 @@ typedef struct byte ca_levelbit,ca_levelnum; int mapon, mapnum; handle_t file; //files to open - //unsigned _seg *mapsegs[4]; + mapinfo_t map; //_seg *grsegs[NUMCHUNKS]; //byte far grneeded[NUMCHUNKS]; //huffnode huffnode; -- 2.39.5