Skip to content

Commit

Permalink
implemented logic to actually do something when the flag is passed to…
Browse files Browse the repository at this point in the history
… the game

This checks if something was passed into --startlevel and then directly loads it,
skipping the cractro, main menu and the intro.
I added the check in the InitNewGameLevel function (basically the same as the --load flag)
  • Loading branch information
Mia75owo committed Jan 18, 2024
1 parent 647c2c8 commit 36d3e79
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Hurrican/src/Gameplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ void InitNewGameLevel() {
int NumTextures = 75; // unknown, use a default
std::string Name;

if (!CommandLineParams.RunUserLevel) {
if (CommandLineParams.StartLevelPath) {
// Directly load into level? (--startlevel)
Name = CommandLineParams.StartLevelPath;
} else if (CommandLineParams.RunUserLevel) {
// Load a user level? (--level)
Name = CommandLineParams.UserLevelName;
} else {
// Nein, dann normales Level in der Reihenfolge laden oder Tutorial Level
if (RunningTutorial) {
Name = "tutorial.map";
Expand All @@ -152,8 +158,7 @@ void InitNewGameLevel() {
Name = StageReihenfolge[Stage - 1];
NumTextures = TextureCount[Stage];
}
} else
Name = CommandLineParams.UserLevelName;
}

pMenu->StartProgressBar(NumTextures);

Expand Down
14 changes: 14 additions & 0 deletions Hurrican/src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,20 @@ int main(int argc, char *argv[]) {
Protokoll << "\n-> GameInit successful!\n" << std::endl;
}

//----- Directly load level?

if (CommandLineParams.StartLevelPath) {
if (!GameInit2()) {
Protokoll << "\n-> GameInit2 error!\n" << std::endl;
GameRunning = false;
} else {
InitNewGame();
InitNewGameLevel();

SpielZustand = GameStateEnum::GAMELOOP;
}
}

//----- Main-Loop

while (GameRunning) {
Expand Down

0 comments on commit 36d3e79

Please sign in to comment.