const char *G_GetSecretExitMap() { const char *nextmap = level.NextMap; if (level.NextSecretMap.Len() > 0) { if (P_CheckMapData(level.NextSecretMap)) { nextmap = level.NextSecretMap; } } return nextmap; }
level_info_t *level_info_t::CheckLevelRedirect () { if (RedirectType != NAME_None) { const PClass *type = PClass::FindClass(RedirectType); if (type != NULL) { for (int i = 0; i < MAXPLAYERS; ++i) { if (playeringame[i] && players[i].mo->FindInventory (type)) { // check for actual presence of the map. if (P_CheckMapData(RedirectMap)) { return FindLevelInfo(RedirectMap); } break; } } } } return NULL; }
void G_InitNew (const char *mapname, bool bTitleLevel) { EGameSpeed oldSpeed; bool wantFast; int i; G_ClearHubInfo(); if (!savegamerestore) { G_ClearSnapshots (); P_RemoveDefereds (); // [RH] Mark all levels as not visited for (unsigned int i = 0; i < wadlevelinfos.Size(); i++) wadlevelinfos[i].flags = wadlevelinfos[i].flags & ~LEVEL_VISITED; } UnlatchCVars (); G_VerifySkill(); UnlatchCVars (); if (paused) { paused = 0; S_ResumeSound (false); } if (StatusBar != NULL) { StatusBar->Destroy(); StatusBar = NULL; } if (bTitleLevel) { StatusBar = new DBaseStatusBar (0); } else if (SBarInfoScript[SCRIPT_CUSTOM] != NULL) { int cstype = SBarInfoScript[SCRIPT_CUSTOM]->GetGameType(); //Did the user specify a "base" if(cstype == GAME_Strife) { StatusBar = CreateStrifeStatusBar(); } else if(cstype == GAME_Any) //Use the default, empty or custom. { StatusBar = CreateCustomStatusBar(SCRIPT_CUSTOM); } else { StatusBar = CreateCustomStatusBar(SCRIPT_DEFAULT); } } if (StatusBar == NULL) { if (gameinfo.gametype & (GAME_DoomChex|GAME_Heretic|GAME_Hexen)) { StatusBar = CreateCustomStatusBar (SCRIPT_DEFAULT); } else if (gameinfo.gametype == GAME_Strife) { StatusBar = CreateStrifeStatusBar (); } else { StatusBar = new DBaseStatusBar (0); } } GC::WriteBarrier(StatusBar); StatusBar->AttachToPlayer (&players[consoleplayer]); StatusBar->NewGame (); setsizeneeded = true; if (gameinfo.gametype == GAME_Strife || (SBarInfoScript[SCRIPT_CUSTOM] != NULL && SBarInfoScript[SCRIPT_CUSTOM]->GetGameType() == GAME_Strife)) { // Set the initial quest log text for Strife. for (i = 0; i < MAXPLAYERS; ++i) { players[i].SetLogText ("Find help"); } } // [RH] If this map doesn't exist, bomb out if (!P_CheckMapData(mapname)) { I_Error ("Could not find map %s\n", mapname); } oldSpeed = GameSpeed; wantFast = !!G_SkillProperty(SKILLP_FastMonsters); GameSpeed = wantFast ? SPEED_Fast : SPEED_Normal; if (!savegamerestore) { if (!netgame && !demorecording && !demoplayback) { // [RH] Change the random seed for each new single player game // [ED850] The demo already sets the RNG. rngseed = use_staticrng ? staticrngseed : (rngseed + 1); } FRandom::StaticClearRandom (); P_ClearACSVars(true); level.time = 0; level.maptime = 0; level.totaltime = 0; if (!multiplayer || !deathmatch) { InitPlayerClasses (); } // force players to be initialized upon first level load for (i = 0; i < MAXPLAYERS; i++) players[i].playerstate = PST_ENTER; // [BC] STAT_StartNewGame(mapname); } usergame = !bTitleLevel; // will be set false if a demo paused = 0; demoplayback = false; automapactive = false; viewactive = true; V_SetBorderNeedRefresh(); //Added by MC: Initialize bots. if (!deathmatch) { bglobal.Init (); } level.MapName = mapname; if (bTitleLevel) { gamestate = GS_TITLELEVEL; } else if (gamestate != GS_STARTUP) { gamestate = GS_LEVEL; } G_DoLoadLevel (0, false); }