diff options
| -rw-r--r-- | joshua.c | 32 |
1 files changed, 25 insertions, 7 deletions
@@ -1,7 +1,7 @@ #include <joshua.h> #include <curses.h> #include <stdlib.h> -#define RANDOM_LOOPS 3 +#define RANDOM_TIME 1 #define SLEEP_TIME 50000 void allLower(char* str) { @@ -17,6 +17,7 @@ void print_string(const char* str) /* print string, slowly */ { addch(str[i]); usleep(SLEEP_TIME); + beep(); refresh(); ++i; } @@ -24,14 +25,16 @@ void print_string(const char* str) /* print string, slowly */ void random_stuff(void) /* print random junk on the screen for about 3 seconds */ { int maxx, maxy; + int stop=time(0)+RANDOM_TIME; getmaxyx(stdscr, maxy, maxx); - for(int i=0;i<RANDOM_LOOPS;++i) + for(;time(0)<=stop;) { for(int x=0;x<maxx;++x) { for(int y=0;y<maxy;++y) { mvaddch(y, x, (rand()%255)+1); + beep(); } } refresh(); @@ -42,7 +45,10 @@ void be_joshua() { initscr(); clear(); - color_set(COLOR_PAIR(COLOR_BLUE), 0); + /* + start_color(); + init_pair(1, COLOR_BLUE, COLOR_BLACK); + attron(COLOR_PAIR(1));*/ char buf[33]; do { print_string("LOGON: "); @@ -50,17 +56,29 @@ void be_joshua() int ret=getnstr(buf, 32); allLower(buf); usleep(SLEEP_TIME*25); - if(ret==ERR || strcmp(buf, "joshua")) + if(strcmp(buf, "help logon")==0) { - print_string("Unknown user.\n"); - refresh(); + print_string("\nHELP NOT AVAILABLE\n\n\n"); + } + else if(strcmp(buf, "help games")==0) + { + print_string("\n'GAMES' REFERS TO MODELS, SIMULATIONS AND GAMES\nWHICH HAVE TACTICAL AND STRATEGIC APPLICATIONS.\n\n\n"); + } + else if(strcmp(buf, "list games")==0) + { + print_string("\nFALKEN'S MAZE\nBLACK JACK\nGIN RUMMY\nHEARTS\nBRIDGE\nCHECKERS\nCHESS\nPOKER\nFIGHTER COMBAT\nGUERRILLA ENGAGEMENT\nDESERT WARFARE\nAIR-TO-GROUND ACTIONS\nTHEATERWIDE TACTICAL WARFARE\nTHEATERWIDE BIOTOXIC AND CHEMICAL WARFARE\n\nGLOBAL THERMONUCLEAR WAR\n\n\n"); + } + else if(ret==ERR || strcmp(buf, "joshua")) + { + print_string("IDENTIFICATION NOT RECOGNIZED BY SYSTEM\n--CONNECTION TERMINATED--"); + return; } } while(strcmp(buf, "joshua")); random_stuff(); print_string("GREETINGS, PROFESSOR FALKEN.\n\n"); refresh(); getnstr(buf, 32); /* ignore this */ - print_string("\nHOW ARE YOU FEELING TODAY?\n\n"); + print_string("\n\nHOW ARE YOU FEELING TODAY?\n\n"); refresh(); endwin(); } |