Skip to content

Commit d9617fa

Browse files
committed
ck_main: Allow specifying difficulty with /TEDLEVEL
In theory, you should be able to test different difficulty levels with /EASY, /NORMAL, /HARD when using /TEDLEVEL. This previously wasn't implemented, so it always defaulted to Normal. Note that the _first_ argument present is used, overriding any later ones. Many other Omnispeak arguments works the other way (later ones overriding earlier ones), but this should match Keen.
1 parent 540ea42 commit d9617fa

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/ck_main.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,21 @@ void CK_DemoLoop()
199199

200200
if (us_tedLevel)
201201
{
202+
static const char *difficultyParms[] = {"easy", "normal", "hard", ""};
202203
CK_NewGame();
203204
CA_LoadAllSounds();
204205
ck_gameState.currentLevel = us_tedLevelNumber;
205206
ck_startingDifficulty = D_Normal;
206207

207-
// TODO: Support selecting difficulty via an extra command line
208-
// argument ("easy", "normal", "hard")
208+
for (int i = 1; i < us_argc; ++i)
209+
{
210+
int difficulty = US_CheckParm(us_argv[i], difficultyParms);
211+
if (difficulty == -1)
212+
continue;
213+
214+
ck_startingDifficulty = (CK_Difficulty)((int)D_Easy + difficulty);
215+
break;
216+
}
209217

210218
CK_GameLoop();
211219
Quit(0); // run_ted

0 commit comments

Comments
 (0)