MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / LoadMission

Function LoadMission

Descent3/Mission.cpp:884–1208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

882#endif
883
884bool LoadMission(const char *mssn) {
885 Times_game_restored = 0;
886 mprintf(0, "In LoadMission()\n");
887// ShowProgressScreen(TXT_LOADINGLEVEL);
888#if (defined(OEM) || defined(DEMO))
889#ifdef OEM
890 if (stricmp(mssn, "d3oem.mn3") == 0)
891 return DemoMission(0);
892#elif defined(DEMO)
893 if (stricmp(mssn, "d3demo.mn3") == 0)
894 return DemoMission(0);
895#endif
896 else if (stricmp(mssn, "polaris.d3l") == 0)
897 return DemoMission(1);
898 else if (stricmp(mssn, "thecore.d3l") == 0)
899 return DemoMission(2);
900 else if (stricmp(mssn, "taurus.d3l") == 0)
901 return DemoMission(3);
902#ifdef OEM
903 else if (stricmp(mssn, "training.mn3") == 0)
904 return DemoMission(4);
905#endif
906#else
907
908 // #endif
909 tLevelNode *lvls = NULL; // Temporary storage for level data.
910 tMission *msn;
911 CFILE *fp = NULL; // Mission file
912 char errtext[80]; // Stores error if unable to read mission
913 char msnfname[_MAX_PATH];
914 char mission[_MAX_PATH];
915 int srclinenum = 0; // Current line of source.
916 int curlvlnum; // Current level number
917 int numlevels; // Number of levels required to read in.
918 int cur_objective; // current objective reading.
919 bool indesc; // are we in a multi-line block
920 bool res = false; // used to specify if no error has occurred.
921 char pathname[_MAX_PATH];
922 ResetMission(); // Reset everything.
923 // open MN3 if filename passed was an mn3 file.
924
925 if (IS_MN3_FILE(mssn)) {
926 strcpy(mission, mssn);
927 ddio_MakePath(pathname, D3MissionsDir, mission, NULL);
928 } else {
929 strcpy(mission, mssn);
930 strcpy(pathname, mssn);
931 strcpy(msnfname, mssn);
932 // ddio_MakePath(pathname, D3MissionsDir, mission, NULL);
933 }
934 if (IS_MN3_FILE(mission)) {
935
936 if (!mn3_Open(pathname)) {
937 strcpy(errtext, TXT_MSN_OPENMN3FAILED);
938 goto msnfile_error;
939 }
940 MN3_TO_MSN_NAME(mission, msnfname);
941 }

Callers 5

LGSMissionFunction · 0.85
RunServerConfigsFunction · 0.85
DemoReadHeaderFunction · 0.85
menu.cppFile · 0.85

Calls 15

DemoMissionFunction · 0.85
ResetMissionFunction · 0.85
IS_MN3_FILEFunction · 0.85
mn3_OpenFunction · 0.85
MN3_TO_MSN_NAMEFunction · 0.85
cfopenFunction · 0.85
cfeofFunction · 0.85
cf_ReadStringFunction · 0.85
CleanupStrFunction · 0.85
FindShipNameFunction · 0.85
PlayerSetShipPermissionFunction · 0.85

Tested by

no test coverage detected