diff --git a/src/main.c b/src/main.c index 4891c09..3bf7807 100644 --- a/src/main.c +++ b/src/main.c @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) initSDL(); - SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN); initGameSystem(); @@ -114,11 +114,63 @@ static long capFrameRate(const long then) static void handleCommandLine(int argc, char *argv[]) { int i; + char *worldId; + + worldId = NULL; for (i = 1 ; i < argc ; i++) { - + if (strcmp(argv[i], "-debug") == 0) + { + dev.debug = 1; + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG); + } + + if (strcmp(argv[i], "-info") == 0) + { + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + } + + if (strcmp(argv[i], "-blind") == 0) + { + dev.cheatBlind = 1; + } + + if (strcmp(argv[i], "-noenemies") == 0) + { + dev.cheatNoEnemies = 1; + } + + if (strcmp(argv[i], "-keys") == 0) + { + dev.cheatKeys = 1; + } + + if (strcmp(argv[i], "-power") == 0) + { + dev.cheatPower = 1; + } + + if (strcmp(argv[i], "-health") == 0) + { + dev.cheatHealth = 1; + } + + if (strcmp(argv[i], "-levels") == 0) + { + dev.cheatLevels = 1; + } + + if (strcmp(argv[i], "-screenshots") == 0) + { + dev.takeScreenshots = 1; + } + + if (strcmp(argv[i], "-world") == 0) + { + worldId = argv[++i]; + } } - - initAtlasTest(); + + initWorldTest(worldId); } diff --git a/src/main.h b/src/main.h index 3bce8da..f8c717a 100644 --- a/src/main.h +++ b/src/main.h @@ -28,10 +28,10 @@ extern void drawTrophyAlert(void); extern void expireTexts(int all); extern void handleInput(void); extern void init18N(int argc, char *argv[]); -extern void initAtlasTest(void); extern void initGameSystem(void); extern void initLookups(void); extern void initSDL(void); +extern void initWorldTest(char *worldId); extern void prepareScene(void); extern void presentScene(void); extern void saveScreenshot(char *name); diff --git a/src/test/atlasTest.c b/src/test/atlasTest.c deleted file mode 100644 index 2b670e5..0000000 --- a/src/test/atlasTest.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright (C) 2018 Parallel Realities - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -#include "atlasTest.h" - -void initAtlasTest(void) -{ - int test; - - dev.debug = 0; - dev.cheatStatic = 0; - dev.cheatBlind = 1; - dev.cheatNoEnemies = 0; - dev.cheatKeys = 0; - dev.cheatPower = 0; - dev.cheatHealth = 0; - dev.cheatLevels = 0; - dev.takeScreenshots = 0; - - loadGame(); - - saveGame(); - - createScreenshotFolder(); - - test = 2; - - switch (test) - { - case 0: - initOptions(); - break; - - case 1: - STRNCPY(game.worldId, "beachApproach", MAX_NAME_LENGTH); - initWorld(); - break; - - case 2: - initHub(); - break; - } -} diff --git a/src/test/worldTest.c b/src/test/worldTest.c new file mode 100644 index 0000000..c8ccb9d --- /dev/null +++ b/src/test/worldTest.c @@ -0,0 +1,20 @@ +#include "worldTest.h" + +void initWorldTest(char *worldId) +{ + loadGame(); + + saveGame(); + + createScreenshotFolder(); + + if (worldId != NULL) + { + STRNCPY(game.worldId, worldId, MAX_NAME_LENGTH); + initWorld(); + } + else + { + initHub(); + } +} diff --git a/src/test/atlasTest.h b/src/test/worldTest.h similarity index 100% rename from src/test/atlasTest.h rename to src/test/worldTest.h