======================\r
*/\r
\r
-/*void CAL_SetupMapFile (void)\r
+void CAL_SetupMapFile (global_game_variables_t *gvar)\r
{\r
int handle;\r
long length;\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
- Quit ("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
+// Quit ("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
-#ifdef MAPHEADERLINKED\r
- if ((maphandle = open("GAMEMAPS."EXT,\r
+//todo multiple files\r
+ if ((gvar->ca.file.maphandles[0] = open("data/test.map",\r
O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
- Quit ("Can't open GAMEMAPS."EXT"!");\r
-#else\r
- if ((maphandle = open("MAPTEMP."EXT,\r
- O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
- Quit ("Can't open MAPTEMP."EXT"!");\r
-#endif\r
-}*/\r
+ {\r
+ printf("Can't open data/test.map!");\r
+ }\r
+// #ifdef MAPHEADERLINKED\r
+// if ((maphandle = open("GAMEMAPS."EXT,\r
+// O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+// Quit ("Can't open GAMEMAPS."EXT"!");\r
+// //#else\r
+// if ((maphandle = open("MAPTEMP."EXT,\r
+// O_RDONLY | O_BINARY, S_IREAD)) == -1)\r
+// Quit ("Can't open MAPTEMP."EXT"!");\r
+// #endif\r
+}\r
\r
//==========================================================================\r
\r
unlink("meminfo.16w");\r
gvar->handle.showmemhandle = open("meminfo.16w", O_CREAT | O_WRONLY | O_TEXT);\r
#endif\r
-/* CAL_SetupMapFile ();\r
+/*\r
CAL_SetupGrFile ();\r
CAL_SetupAudioFile ();*/\r
-/*++++\r
-// MDM begin - (GAMERS EDGE)\r
-//\r
- if(!FindFile("AUDIO."EXT,NULL,2))\r
- Quit("CA_Startup(): Can't find audio files.");\r
-//\r
-// MDM end\r
-\r
-#ifndef NOAUDIO\r
- CAL_SetupAudioFile();\r
-#endif\r
-\r
-// MDM begin - (GAMERS EDGE)\r
-//\r
- if (!FindFile("GAMEMAPS."EXT,NULL,1))\r
- Quit("CA_Startup(): Can't find level files.");\r
-//\r
-// MDM end\r
\r
-#ifndef NOMAPS\r
- CAL_SetupMapFile ();\r
-#endif\r
-\r
-// MDM begin - (GAMERS EDGE)\r
-//\r
- if (!FindFile("EGAGRAPH."EXT,NULL,2))\r
- Quit("CA_Startup(): Can't find graphics files.");\r
-//\r
-// MDM end\r
-\r
-#ifndef NOGRAPHICS\r
- CAL_SetupGrFile ();\r
-#endif*/\r
+ CAL_SetupMapFile (gvar);\r
\r
gvar->ca.mapon = -1;\r
gvar->ca.ca_levelbit = 1;\r
{\r
int profilehandle,debughandle,showmemhandle;\r
int heaphandle;\r
-} handle_t;\r
+} loghandle_t;\r
\r
typedef struct\r
{\r
//from 16_ca\r
//==========================================================================\r
\r
+typedef struct\r
+{\r
+ int maphandles[4]; // handle to MAPTEMP / GAMEMAPS\r
+} handle_t;\r
+\r
typedef struct\r
{\r
byte ca_levelbit,ca_levelnum;\r
int mapon;\r
+ handle_t file; //files to open\r
//_seg *grsegs[NUMCHUNKS];\r
//byte far grneeded[NUMCHUNKS];\r
//huffnode huffnode;\r
video_t video; // video settings variable\r
ca_t ca; // ca stuff\r
byte *pee; // message for fps\r
- handle_t handle; //handles for file logging\r
+ loghandle_t handle; //handles for file logging\r
kurokku_t kurokku; //clock struct\r
mminfo_t mm; mminfotype mmi;\r
} global_game_variables_t;\r