X-Git-Url: http://git.shiar.nl/netris.git/blobdiff_plain/6286afa8518283f62f303e5b6ce188c9bb28e562..HEAD:/util.c diff --git a/util.c b/util.c index a667a5b..92a8908 100644 --- a/util.c +++ b/util.c @@ -61,35 +61,6 @@ void Header(void) ); } -void Usage(void) -{ - Header(); - fprintf(stderr, - "Usage: netris \n" - "\n" - " -h, --help\t\tPrint this usage information\n" - " -H, --info\t\tShow distribution and warranty information\n" - " -R, --rules\t\tShow game rules\n" - "\n" - " -S, --slowterm\tDisable inverse/bold/color for slow terminals\n" - " -a, --ascii\t\tUse ascii characters\n" - " -C, --color=0\t\tDisable color\n" - "\n" - " -c, --connect \tInitiate connection\n" - " -p, --port \tSet port number (default is %d)\n" - "\n" - " -t, --team \tJoin a team (don't receive lines from your teammates)\n" - " -l, --level \tBegin at a higher level (can be used as handicap)\n" - " -k, --keys \tRemap keys (default is \"%s\" for cursors)\n" - " -d, --dropmode\tDrops go into drop mode\n" - " -D, --instadrop\tInstant drop\n" - "\n" - " -r, --robot \tExecute program to control the game instead of keyboard\n" - " -F, --fair-robot\tUse fair robot interface\n" - "\n", DEFAULT_PORT, DEFAULT_KEYS - ); -} - void DistInfo(void) { fprintf(stderr, @@ -110,31 +81,6 @@ void DistInfo(void) ); } -void Rules(void) -{ - Header(); - fprintf(stderr, - "One player mode\n" - "---------------\n" - "Good old Tetris. Scoring is like on the GameBoy version (so try to\n" - "remove as many lines at once as you can). After removing ten lines\n" - "you go to the next level, which will be faster thus making the game\n" - "harder to play.\n" - "\n" - "Two player mode\n" - "---------------\n" - "It's just like normal T*tris except that when you clear more than\n" - "one row with a single piece, the other player receives penalty lines\n" - "For clearing 2, 3 or 4 rows, respectively 1, 2 or 4 junk rows will\n" - "be added to the bottom of your opponent's board respectively.\n" - "The junk rows have exactly one empty column, which will line up for\n" - "multiple rows.\n" - "\n" - "The longest surviving player wins the game.\n" - "\n" - ); -} - ///////////// RANDOM ///////////// /* @@ -189,6 +135,24 @@ int MyWrite(int fd, void *data, int len) return len; } +///////////// CONFIG ///////////// + +void WriteConf(void) +{ + FILE *file_out; + + file_out = fopen(CONFIG_FILE, "w"); + if (file_out == NULL) { + perror("Error writing config file"); + exit(1); + } + + fprintf(file_out, "### NETRIS %s Config file ###\n\n", version_string); + + fclose(file_out); + fprintf(stderr, "Wrote new game configuration to %s\n", CONFIG_FILE); +} + ///////////// TIME ///////////// void NormalizeTime(struct timeval *tv) @@ -248,10 +212,7 @@ void ResumeTime(void) long CurTimeval(void) { - struct timeval tv; - - gettimeofday(&tv, NULL); - return GetTimeval(&tv) - baseTimeval; + return AbsTimeval() - baseTimeval; } static long SetITimer1(long interval, long value)