Start arguments
This commit is contained in:
parent
ea105ba3f3
commit
c57ede96c9
3 changed files with 31 additions and 10 deletions
31
game.h
31
game.h
|
@ -120,9 +120,10 @@ char LCR_getNextDataFileChar(void);
|
|||
void LCR_appendDataStr(const char *str);
|
||||
|
||||
/**
|
||||
Call this function in your frontend at the start of the program.
|
||||
Call this function in your frontend at the start of the program. Pass program
|
||||
arguments if there are any.
|
||||
*/
|
||||
void LCR_gameInit(void);
|
||||
void LCR_gameInit(int argc, const char **argv);
|
||||
|
||||
/**
|
||||
Call this function in your frontend right before program end.
|
||||
|
@ -736,7 +737,7 @@ void LCR_gameLoadMainMenuItems(void)
|
|||
LCR_game.menu.itemCount = 4;
|
||||
}
|
||||
|
||||
void LCR_gameInit(void)
|
||||
void LCR_gameInit(int argc, const char **argv)
|
||||
{
|
||||
LCR_LOG0("initializing");
|
||||
|
||||
|
@ -744,7 +745,6 @@ void LCR_gameInit(void)
|
|||
LCR_game.keyStates[i] = 0;
|
||||
|
||||
LCR_rendererInit();
|
||||
|
||||
LCR_racingInit();
|
||||
LCR_audioInit();
|
||||
|
||||
|
@ -762,10 +762,29 @@ void LCR_gameInit(void)
|
|||
LCR_game.nextRacingTickTime = 0;
|
||||
LCR_game.cameraMode = LCR_CAMERA_MODE_DRIVE;
|
||||
|
||||
LCR_LOG2("parsing arguments");
|
||||
|
||||
while (argc) // parse arguments
|
||||
{
|
||||
argc--;
|
||||
|
||||
if (argv[argc][0] == '-')
|
||||
switch (argv[argc][1])
|
||||
{
|
||||
case 'c': LCR_game.cameraMode = (argv[argc][2] - '0') % 4; break;
|
||||
case 'm': LCR_game.musicOn = argv[argc][2] != '0'; break;
|
||||
case 's': LCR_audio.on = argv[argc][2] != '0'; break;
|
||||
|
||||
// TODO
|
||||
|
||||
default:
|
||||
LCR_LOG2("unknown argument");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LCR_gameLoadMainMenuItems();
|
||||
|
||||
LCR_gameSetState(LCR_GAME_STATE_MENU);
|
||||
|
||||
LCR_currentMap.blockCount = 0; // means no map loaded
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue