\r
void CAL_SetupMapFile (global_game_variables_t *gvar)\r
{\r
-// int handle;\r
-// long length;\r
+/* int handle;\r
+ long length;\r
\r
//\r
// load maphead.ext (offsets and tileinfo for map file)\r
//\r
-// #ifndef MAPHEADERLINKED\r
-// if ((handle = open("MAPHEAD."EXT,\r
-// O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
-// printf("Can't open MAPHEAD."EXT"!");\r
-// length = filelength(handle);\r
-// MM_GetPtr (&(memptr)tinf,length);\r
-// CA_FarRead(handle, tinf, length);\r
-// close(handle);\r
-// //#else\r
-//\r
-// tinf = (byte _seg *)FP_SEG(&maphead);\r
-//\r
-// #endif\r
+#ifndef MAPHEADERLINKED\r
+ if ((handle = open("MAPHEAD."EXT,\r
+ O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+ printf("Can't open MAPHEAD."EXT"!");\r
+ length = filelength(handle);\r
+ MM_GetPtr (&(memptr)tinf,length);\r
+ CA_FarRead(handle, tinf, length);\r
+ close(handle);\r
+//#else\r
+\r
+ tinf = (byte _seg *)FP_SEG(&maphead);\r
+\r
+#endif*/\r
\r
//\r
// open the data file\r
//\r
// free up memory from last map\r
//\r
- if (gvar->ca.map.mapon>-1 && gvar->ca.map.mapheaderseg[gvar->ca.map.mapon])\r
- MM_SetPurge (&((memptr)gvar->ca.map.mapheaderseg[(gvar->ca.map.mapon)]), 3, &(gvar->mm));\r
+ if (gvar->ca.camap.mapon>-1 && gvar->ca.camap.mapheaderseg[gvar->ca.camap.mapon])\r
+ MM_SetPurge (((memptr)gvar->ca.camap.mapheaderseg[(gvar->ca.camap.mapon)]), 3, gvar);\r
for (plane=0;plane<MAPPLANES;plane++)\r
- if (gvar->ca.map.mapsegs[plane])\r
- MM_FreePtr (&(memptr)gvar->ca.map.mapsegs[plane], &(gvar->mm));\r
+ if (gvar->ca.camap.mapsegs[plane])\r
+ MM_FreePtr ((memptr)gvar->ca.camap.mapsegs[plane], gvar);\r
\r
- gvar->ca.map.mapon = gvar->ca.map.mapnum;\r
+ gvar->ca.camap.mapon = gvar->ca.camap.mapnum;\r
\r
\r
//\r
// load map header\r
// The header will be cached if it is still around\r
//\r
- if (!gvar->ca.map.mapheaderseg[gvar->ca.map.mapnum])\r
- {\r
- //pos = ((mapfiletype _seg *)tinf)->headeroffsets[mapnum];\r
- pos = ((_seg *)gvar->ca.map.tinf)->headeroffsets[gvar->ca.map.mapnum];\r
- if (pos<0) // $FFFFFFFF start is a sparse map\r
- printf("CA_CacheMap: Tried to load a non existent map!");\r
+// if (!gvar->ca.camap.mapheaderseg[gvar->ca.camap.mapnum])\r
+// {\r
+// //pos = ((mapfiletype _seg *)tinf)->headeroffsets[mapnum];\r
+// //pos = ((_seg *)gvar->ca.camap.tinf)->headeroffsets[gvar->ca.camap.mapnum];\r
+// pos = ((memptr)gvar->ca.camap.tinf)->headeroffsets[gvar->ca.camap.mapnum];\r
+// if (pos<0) // $FFFFFFFF start is a sparse map\r
+// printf("CA_CacheMap: Tried to load a non existent map!");\r
\r
- MM_GetPtr(&(memptr)gvar->ca.mapheaderseg[mapnum],sizeof(maptype));\r
- lseek(maphandle,pos,SEEK_SET);\r
- CA_FarRead (maphandle,(memptr)mapheaderseg[mapnum],sizeof(maptype));\r
- }\r
- else\r
- MM_SetPurge (&(memptr)mapheaderseg[mapnum], 0, &(gvar->mm));\r
+// MM_GetPtr(&(memptr)gvar->ca.camapheaderseg[mapnum],sizeof(maptype));\r
+// lseek(maphandle,pos,SEEK_SET);\r
+// CA_FarRead (maphandle,(memptr)mapheaderseg[mapnum],sizeof(maptype));\r
+// }\r
+// else\r
+// MM_SetPurge (&(memptr)mapheaderseg[mapnum], 0, &(gvar->mm));\r
\r
//\r
// load the planes in\r
\r
for (plane = 0; plane<MAPPLANES; plane++)\r
{\r
- pos = mapheaderseg[mapnum]->planestart[plane];\r
- compressed = mapheaderseg[mapnum]->planelength[plane];\r
+ //pos = mapheaderseg[mapnum]->planestart[plane];\r
+ //compressed = mapheaderseg[mapnum]->planelength[plane];\r
\r
if (!compressed)\r
continue; // the plane is not used in this game\r