void doMiddle() /* Write HTML file to stdout. */ { char *mapName; if ((mapName = cgiOptionalString("map")) != NULL) { printf("<TT>\n"); doMap(mapName); } else if (cgiVarExists("contig")) { doFuzzyFind(); } else { char *bacAcc = cgiString("bacAcc"); char *repeatMask = cgiString("repeatMask"); int trim = cgiInt("trim"); if (trim < 0) trim = 0; bacTrack(bacAcc, trim, repeatMask); } }
int main(int argc, char *argv[]) { unsigned int frameLimit; int go, i, mapID, loadSlot, recordingID, replayingID; int joystick, showCredits, languageID; go = TRUE; loadSlot = -1; game.fps = 1000 / 60; languageID = mapID = recordingID = replayingID = -1; joystick = 0; showCredits = FALSE; /* Load the resources */ for (i=1;i<argc;i++) { if (strcmpignorecase("-record", argv[i]) == 0) { if (i + 1 >= argc) { printf("You must specify a file to record to\n"); printf("Type %s -h for help\n", argv[0]); exit(1); } if (recordingID == -1) { recordingID = i + 1; } i++; } else if (strcmpignorecase("-playback", argv[i]) == 0) { if (i + 1 >= argc) { printf("You must specify a file to playback from\n"); printf("Type %s -h for help\n", argv[0]); exit(1); } if (replayingID == -1) { replayingID = i + 1; } i++; } else if (strcmpignorecase("-load", argv[i]) == 0) { if (i + 1 >= argc) { printf("You must specify a slot to load from\n"); printf("Type %s -h for help\n", argv[0]); exit(1); } loadSlot = atoi(argv[i + 1]); i++; } else if (strcmpignorecase("-nojoystick", argv[i]) == 0) { game.disableJoystick = TRUE; } else if (strcmpignorecase("-joystick", argv[i]) == 0) { if (i + 1 >= argc) { printf("You must specify a joystick slot to use\n"); printf("Type %s -h for help\n", argv[0]); exit(1); } joystick = atoi(argv[i + 1]); i++; } else if (strcmpignorecase("-showcredits", argv[i]) == 0) { showCredits = TRUE; } else if (strstr(argv[i], "-lang") != NULL) { if (i + 1 >= argc) { printf("You must specify a language to use\n"); printf("Type %s -h for help\n", argv[0]); exit(1); } languageID = i + 1; i++; } else if (strstr(argv[i], "-h") != NULL || strstr(argv[i], "-help") != NULL) { printf("The Legend of Edgar options\n\n"); printf("\t-record <filename>: Captures keyboard input\n"); printf("\t-playback <filename>: Replays keyboard input\n"); printf("\t-load <save_slot>: Loads the game in slot <save_slot>. Slots start at 0\n"); printf("\t-nojoystick: Disables the joystick\n"); printf("\t-joystick <joystick_slot>: Use joystick <joystick_slot>. Slots start at 0\n"); printf("\t-showcredits: Shows the end credits\n"); printf("\t-language <language_code>: Use language <language_code>. e.g. en_US, es, pl\n\n"); exit(0); } #if DEV == 1 else if (strcmpignorecase("-saveonexit", argv[i]) == 0) { game.saveOnExit = TRUE; } else if (strcmpignorecase("-bmpwrite", argv[i]) == 0) { setScreenshotDir(argv[i + 1]); i++; } else { mapID = i; } #endif } setLanguage("edgar", languageID == -1 ? NULL : argv[languageID]); printf("Numeric is %s\n", setlocale(LC_NUMERIC, "C")); printf("atof(2.75) is %f\n", atof("2.75")); /* Call the cleanup function when the program exits */ atexit(cleanup); /* Start up SDL */ init(_("The Legend of Edgar"), joystick); loadRequiredResources(); if (replayingID != -1 && recordingID != -1) { showErrorAndExit("Cannot record and replay at the same time"); } #if DEV == 0 verifyVersion(); #endif /* Initialise the game variables */ freeGameResources(); initGame(); if (loadSlot == -1) { if (recordingID != -1) { setRecordData(argv[recordingID]); setMapFile(mapID == -1 ? "map01" : argv[mapID]); } else if (replayingID != -1) { setReplayData(argv[replayingID], TRUE); setMapFile(mapID == -1 ? "map01" : argv[mapID]); } if (mapID != -1) { startOnMap(argv[mapID]); } else if (game.firstRun == TRUE) { tutorial(); } else { game.status = IN_TITLE; } } else { if (recordingID != -1) { game.gameType = RECORDING; } else if (replayingID != -1) { game.gameType = REPLAYING; } if (loadGame(loadSlot) == FALSE) { showErrorAndExit("No saved game in slot %d", loadSlot); } if (recordingID != -1) { setRecordData(argv[recordingID]); setMapFile(getMapFilename()); } else if (replayingID != -1) { setReplayData(argv[replayingID], TRUE); } } /* Loop indefinitely for messages */ game.startTicks = SDL_GetTicks(); #if DEV == 1 printf("DEV Version\n"); #else printf("Production Version\n"); #endif frameLimit = SDL_GetTicks() + game.fps; if (showCredits == TRUE) { game.status = IN_CREDITS; } while (go == TRUE) { getInput(game.gameType); switch (game.status) { case IN_TITLE: doTitle(); break; case IN_GAME: freeCollisionGrid(); clearDrawLayers(); doGame(); doPlayer(); doInventory(); doMap(); doEntities(); doDecorations(); doCollisions(); doHud(); doDialogBox(); processMedals(); break; case IN_INVENTORY: doInventoryMenu(); break; case IN_MENU: doMenu(); break; case IN_CREDITS: freeCollisionGrid(); clearDrawLayers(); doGame(); doCredits(); doDecorations(); doCollisions(); break; default: doMenu(); break; } draw(); /* Sleep briefly to stop sucking up all the CPU time */ delay(frameLimit); frameLimit = SDL_GetTicks() + game.fps; game.frames++; } /* Exit the program */ exit(0); }
ParseOptionMaps::ParseOptionMaps() { doMap(PO_NO_GLOBAL_VARS, "PO_NO_GLOBAL_VARS"); doMap(PO_NO_SUBROUTINE_DEFS, "PO_NO_SUBROUTINE_DEFS"); doMap(PO_NO_THREAD_CONTROL, "PO_NO_THREAD_CONTROL"); doMap(PO_NO_THREAD_CLASSES, "PO_NO_THREAD_CLASSES"); doMap(PO_NO_TOP_LEVEL_STATEMENTS, "PO_NO_TOP_LEVEL_STATEMENTS"); doMap(PO_NO_CLASS_DEFS, "PO_NO_CLASS_DEFS"); doMap(PO_NO_NAMESPACE_DEFS, "PO_NO_NAMESPACE_DEFS"); doMap(PO_NO_CONSTANT_DEFS, "PO_NO_CONSTANT_DEFS"); doMap(PO_NO_NEW, "PO_NO_NEW"); doMap(PO_NO_INHERIT_SYSTEM_CLASSES, "PO_NO_INHERIT_SYSTEM_CLASSES"); doMap(PO_NO_INHERIT_USER_CLASSES, "PO_NO_INHERIT_USER_CLASSES"); doMap(PO_NO_CHILD_PO_RESTRICTIONS, "PO_NO_CHILD_PO_RESTRICTIONS"); doMap(PO_NO_EXTERNAL_PROCESS, "PO_NO_EXTERNAL_PROCESS"); doMap(PO_REQUIRE_OUR, "PO_REQUIRE_OUR"); doMap(PO_NO_PROCESS_CONTROL, "PO_NO_PROCESS_CONTROL"); doMap(PO_NO_NETWORK, "PO_NO_NETWORK"); doMap(PO_NO_FILESYSTEM, "PO_NO_FILESYSTEM"); doMap(PO_LOCK_WARNINGS, "PO_LOCK_WARNINGS"); doMap(PO_NO_DATABASE, "PO_NO_DATABASE"); doMap(PO_NO_GUI, "PO_NO_GUI"); doMap(PO_NO_TERMINAL_IO, "PO_NO_TERMINAL_IO"); doMap(PO_REQUIRE_TYPES, "PO_REQUIRE_TYPES"); doMap(PO_NO_EXTERNAL_INFO, "PO_NO_EXTERNAL_INFO"); doMap(PO_NO_THREAD_INFO, "PO_NO_THREAD_INFO"); doMap(PO_NO_LOCALE_CONTROL, "PO_NO_LOCALE_CONTROL"); doMap(PO_REQUIRE_PROTOTYPES, "PO_REQUIRE_PROTOTYPES"); doMap(PO_STRICT_ARGS, "PO_STRICT_ARGS"); //doMap(PO_REQUIRE_BARE_REFS, "PO_REQUIRE_BARE_REFS"); doMap(PO_ASSUME_LOCAL, "PO_ASSUME_LOCAL"); doMap(PO_NO_MODULES, "PO_NO_MODULES"); doMap(PO_NO_INHERIT_USER_FUNC_VARIANTS, "PO_NO_INHERIT_USER_FUNC_VARIANTS"); doMap(PO_NO_INHERIT_SYSTEM_FUNC_VARIANTS, "PO_NO_INHERIT_SYSTEM_FUNC_VARIANTS"); doMap(PO_NO_INHERIT_GLOBAL_VARS, "PO_NO_INHERIT_GLOBAL_VARS"); doMap(PO_IN_MODULE, "PO_IN_MODULE"); doMap(PO_NO_EMBEDDED_LOGIC, "PO_NO_EMBEDDED_LOGIC"); doMap(PO_STRICT_BOOLEAN_EVAL, "PO_STRICT_BOOLEAN_EVAL"); doMap(PO_DEFAULT, "PO_DEFAULT"); //doMap(PO_SYSTEM_OPS, "PO_SYSTEM_OPS"); doMap(PO_ALLOW_BARE_REFS, "PO_ALLOW_BARE_REFS"); doMap(PO_NO_THREADS, "PO_NO_THREADS"); doMap(PO_NO_EXTERNAL_ACCESS, "PO_NO_EXTERNAL_ACCESS"); doMap(PO_NO_IO, "PO_NO_IO"); doMap(PO_LOCKDOWN, "PO_LOCKDOWN"); doMap(PO_NEW_STYLE, "PO_NEW_STYLE"); doMap(PO_ALLOW_INJECTION, "PO_ALLOW_INJECTION"); doMap(PO_NO_INHERIT_SYSTEM_CONSTANTS, "PO_NO_INHERIT_SYSTEM_CONSTANTS"); doMap(PO_NO_INHERIT_USER_CONSTANTS, "PO_NO_INHERIT_USER_CONSTANTS"); }