main.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifdef _WIN32
  2. # include <curses.h>
  3. #else
  4. # include <ncurses.h>
  5. #endif
  6. #include <stdlib.h>
  7. #include <time.h>
  8. #include <string.h>
  9. #include "intro.h"
  10. #include "pass.h"
  11. #include "wordParse.h"
  12. int main(int argc, char * argv[]){
  13. if(argc > 1 && !strcmp(argv[1], "--help")){
  14. printf("Usage: %s [--DIFFICULTY]\n\n[--DIFFICULTY] is an optional argument"
  15. " that uses built in words instead\nof words specifed in the config"
  16. " file. Options are:\n\n"
  17. "--veryEasy,\t10 words, 5 letters per word (default)\n\n"
  18. "--easy,\t\t11 words, 7 letters per word\n\n"
  19. "--average,\t14 words, 9 letters per word\n\n"
  20. "--hard,\t\t7 words, 11 letters per word\n\n"
  21. "--veryHard,\t13 words, 12 letters per word\n\n"
  22. , argv[0]);
  23. exit(0);
  24. }
  25. srand ( (unsigned)time(NULL) );
  26. initscr();
  27. noecho();
  28. refresh();
  29. attron(A_BOLD);
  30. nodelay(stdscr, 1);
  31. if(has_colors() == 1){
  32. /* Colors */
  33. start_color();
  34. init_pair(1,COLOR_GREEN,COLOR_BLACK);
  35. attron(COLOR_PAIR(1));
  36. }
  37. FILE *fp = NULL;
  38. if(argc > 1){
  39. if(!strcmp(argv[1], "--easy")) {
  40. setEasy();
  41. }
  42. else if(!strcmp(argv[1], "--average")) {
  43. setAverage();
  44. }
  45. else if(!strcmp(argv[1], "--hard")) {
  46. setHard();
  47. }
  48. else if(!strcmp(argv[1], "--veryHard")) {
  49. setVeryHard();
  50. }
  51. else {
  52. setVeryEasy();
  53. }
  54. }
  55. else {
  56. fp = fopen("FalloutTerminal.cfg", "r");
  57. readFile(fp);
  58. }
  59. intro();
  60. pass();
  61. if(fp != NULL) {
  62. fclose(fp);
  63. }
  64. return 0;
  65. }