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

Function LoadMissionLevel

Descent3/Mission.cpp:1275–1306  ·  view source on GitHub ↗

loads a level and sets it as current level in mission */

Source from the content-addressed store, hash-verified

1273/* loads a level and sets it as current level in mission
1274 */
1275bool LoadMissionLevel(int level) {
1276 Hud_show_controls = false;
1277 LoadLevelProgress(LOAD_PROGRESS_START, 0);
1278 if (!LoadLevel(Current_mission.levels[level - 1].filename, NULL)) {
1279 char buf[128];
1280 snprintf(buf, sizeof(buf), TXT_MSNERROR, Current_mission.levels[level - 1].filename);
1281 SetUICallback(DEFAULT_UICALLBACK);
1282 DoMessageBox(TXT_ERROR, buf, MSGBOX_OK);
1283 LoadLevelProgress(LOAD_PROGRESS_DONE, 0);
1284 return false;
1285 }
1286 // Test to see if levels are valid
1287 bool boa = true, terrain = true;
1288 char str[255];
1289
1290 if (BOAGetMineChecksum() != BOA_vis_checksum)
1291 boa = false;
1292 if (GetTerrainGeometryChecksum() != Terrain_checksum)
1293 terrain = false;
1294
1295 // JC: This isn't going to be fixed for a while, so silence the error
1296 /*
1297 if (!boa) {
1298 snprintf(str, sizeof(str), "BOA NOT VALID! %s", terrain ? "" : "TERRAINOCC NOT VALID!");
1299 ShowProgressScreen(str, NULL, true);
1300 Sleep(2000);
1301 } */
1302
1303 LoadLevelText(Current_mission.levels[level - 1].filename);
1304
1305 return true;
1306}
1307#define LOADBAR_X (16 * (float)Max_window_w / (float)FIXED_SCREEN_WIDTH)
1308#define LOADBAR_Y1 (376 * (float)Max_window_h / (float)FIXED_SCREEN_HEIGHT)
1309#define LOADBAR_Y2 (440 * (float)Max_window_h / (float)FIXED_SCREEN_HEIGHT)

Callers 1

LoadAndStartCurrentLevelFunction · 0.85

Calls 7

LoadLevelProgressFunction · 0.85
LoadLevelFunction · 0.85
SetUICallbackFunction · 0.85
DoMessageBoxFunction · 0.85
BOAGetMineChecksumFunction · 0.85
LoadLevelTextFunction · 0.85

Tested by

no test coverage detected