Advances to the next level. If we were on the last level, end the game
| 1975 | |
| 1976 | // Advances to the next level. If we were on the last level, end the game |
| 1977 | void SetNextLevel() { |
| 1978 | ASSERT(Current_mission.cur_level > 0); |
| 1979 | |
| 1980 | tLevelNode *lvl = &Current_mission.levels[Current_mission.cur_level - 1]; |
| 1981 | |
| 1982 | if (Game_mode & GM_MULTI && Multi_next_level != -1) { |
| 1983 | SetCurrentLevel(Multi_next_level); |
| 1984 | Multi_next_level = -1; |
| 1985 | } else if (lvl->flags & LVLFLAG_BRANCH) { |
| 1986 | // jump to brached level |
| 1987 | mprintf(0, "Branching...\n"); |
| 1988 | Current_mission.cur_level = lvl->lvlbranch0; |
| 1989 | SetCurrentLevel(Current_mission.cur_level); |
| 1990 | } else if ((Current_mission.cur_level == Current_mission.num_levels) || (lvl->flags & LVLFLAG_FINAL)) { |
| 1991 | // in this case we are done with the mission! |
| 1992 | DoEndMission(); |
| 1993 | |
| 1994 | if (!(Game_mode & GM_MULTI)) // Multiplayer loops its levels and never ends |
| 1995 | { |
| 1996 | SetFunctionMode(MENU_MODE); |
| 1997 | } |
| 1998 | } else if (Current_mission.game_state_flags & MSN_STATE_SECRET_LEVEL) { |
| 1999 | if (lvl->flags & LVLFLAG_SPAWNSECRET) { |
| 2000 | // display secret level screen? |
| 2001 | ShowProgressScreen(TXT_ENTERSECRETLVL, NULL, true); |
| 2002 | Descent->delay(1.0f); |
| 2003 | Current_mission.game_state_flags &= (~MSN_STATE_SECRET_LEVEL); |
| 2004 | SetCurrentLevel(lvl->secretlvl); |
| 2005 | } else { |
| 2006 | Int3(); // Game says go to secret level, but there's none to go to. |
| 2007 | SetCurrentLevel(Current_mission.cur_level + 1); |
| 2008 | } |
| 2009 | } else { |
| 2010 | // nothing special |
| 2011 | SetCurrentLevel(Current_mission.cur_level + 1); |
| 2012 | } |
| 2013 | } |
| 2014 | |
| 2015 | void GameFrameUI() { |
| 2016 | GameFrame(); |
no test coverage detected