diff options
Diffstat (limited to 'src/main-gcu.c')
-rw-r--r-- | src/main-gcu.c | 178 |
1 files changed, 5 insertions, 173 deletions
diff --git a/src/main-gcu.c b/src/main-gcu.c index 4e259a65..3e1d1ff0 100644 --- a/src/main-gcu.c +++ b/src/main-gcu.c @@ -38,8 +38,8 @@ * Consider the use of "savetty()" and "resetty()". XXX XXX XXX */ - -#include "angband.h" +#include "util.h" +#include "variable.h" #ifdef USE_GCU @@ -82,7 +82,7 @@ # if defined(_POSIX_VERSION) # define USE_TPOSIX # else -# if defined(USG) || defined(linux) || defined(SOLARIS) +# if defined(linux) # define USE_TERMIO # else # define USE_TCHARS @@ -122,11 +122,6 @@ #include <unistd.h> #include <dirent.h> -/* /me pffts Solaris */ -#ifndef NAME_MAX -#define NAME_MAX _POSIX_NAME_MAX -#endif - /* @@ -561,60 +556,6 @@ static void Term_nuke_gcu(term *t) } - - -#ifdef USE_GETCH - -/* - * Process events, with optional wait - */ -static errr Term_xtra_gcu_event(int v) -{ - int i, k; - - /* Wait */ - if (v) - { - /* Paranoia -- Wait for it */ - nodelay(stdscr, FALSE); - - /* Get a keypress */ - i = getch(); - - /* Mega-Hack -- allow graceful "suspend" */ - for (k = 0; (k < 10) && (i == ERR); k++) i = getch(); - - /* Broken input is special */ - if (i == ERR) abort(); - if (i == EOF) abort(); - } - - /* Do not wait */ - else - { - /* Do not wait for it */ - nodelay(stdscr, TRUE); - - /* Check for keypresses */ - i = getch(); - - /* Wait for it next time */ - nodelay(stdscr, FALSE); - - /* None ready */ - if (i == ERR) return (1); - if (i == EOF) return (1); - } - - /* Enqueue the keypress */ - Term_keypress(i); - - /* Success */ - return (0); -} - -#else /* USE_GETCH */ - /* * Process events (with optional wait) */ @@ -663,7 +604,6 @@ static errr Term_xtra_gcu_event(int v) return (0); } -#endif /* USE_GETCH */ /* * React to changes @@ -721,14 +661,6 @@ static errr Term_xtra_gcu(int n, int v) (void)wrefresh(td->win); return (0); -#ifdef USE_CURS_SET - - /* Change the cursor visibility */ - case TERM_XTRA_SHAPE: - curs_set(v); - return (0); - -#endif /* Suspend/Resume curses */ case TERM_XTRA_ALIVE: @@ -743,53 +675,6 @@ static errr Term_xtra_gcu(int n, int v) while (!Term_xtra_gcu_event(FALSE)); return (0); - /* Delay */ - case TERM_XTRA_DELAY: - usleep(1000 * v); - return (0); - - /* Get Delay of some milliseconds */ - case TERM_XTRA_GET_DELAY: - { - int ret; - struct timeval tv; - - ret = gettimeofday(&tv, NULL); - Term_xtra_long = (tv.tv_sec * 1000) + (tv.tv_usec / 1000); - - return ret; - } - - /* Subdirectory scan */ - case TERM_XTRA_SCANSUBDIR: - { - DIR *directory; - struct dirent *entry; - - scansubdir_max = 0; - - directory = opendir(scansubdir_dir); - if (!directory) - return 1; - - while ((entry = readdir(directory))) - { - char file[PATH_MAX + NAME_MAX + 2]; - struct stat filedata; - - file[PATH_MAX + NAME_MAX] = 0; - strncpy(file, scansubdir_dir, PATH_MAX); - strncat(file, "/", 2); - strncat(file, entry->d_name, NAME_MAX); - if (!stat(file, &filedata) && S_ISDIR((filedata.st_mode))) - { - string_free(scansubdir_result[scansubdir_max]); - scansubdir_result[scansubdir_max] = string_make(entry->d_name); - ++scansubdir_max; - } - } - } - /* React to events */ case TERM_XTRA_REACT: Term_xtra_gcu_react(); @@ -851,7 +736,7 @@ static errr Term_text_gcu(int x, int y, int n, byte a, cptr s) { term_data *td = (term_data *)(Term->data); - int i, pic; + int i; #ifdef A_COLOR /* Set the color */ @@ -864,41 +749,6 @@ static errr Term_text_gcu(int x, int y, int n, byte a, cptr s) /* Draw each character */ for (i = 0; i < n; i++) { -#ifdef USE_GRAPHICS - /* Special character */ - if (use_graphics && (s[i] & 0x80)) - { - /* Determine picture to use */ - switch (s[i] & 0x7F) - { - -#ifdef ACS_CKBOARD - /* Wall */ - case '#': - pic = ACS_CKBOARD; - break; -#endif /* ACS_CKBOARD */ - -#ifdef ACS_BOARD - /* Mineral vein */ - case '%': - pic = ACS_BOARD; - break; -#endif /* ACS_BOARD */ - - /* XXX */ - default: - pic = '?'; - break; - } - - /* Draw the picture */ - waddch(td->win, pic); - - /* Next character */ - continue; - } -#endif /* Draw a normal character */ waddch(td->win, (byte)s[i]); @@ -995,7 +845,7 @@ errr init_gcu(int argc, char **argv) continue; } - plog_fmt("Ignoring option: %s", argv[i]); + fprintf(stderr, "Ignoring option: %s", argv[i]); } @@ -1003,17 +853,11 @@ errr init_gcu(int argc, char **argv) keymap_norm_prepare(); -#if defined(USG) - /* Initialize for USG Unix */ - if (initscr() == NULL) return ( -1); -#else /* Initialize for other systems */ if (initscr() == (WINDOW*)ERR) return ( -1); -#endif /* Activate hooks */ quit_aux = hook_quit; - core_aux = hook_quit; /* Require standard size screen */ if ((LINES < 24) || (COLS < 80)) @@ -1022,12 +866,6 @@ errr init_gcu(int argc, char **argv) } -#ifdef USE_GRAPHICS - - /* Set graphics flag */ - use_graphics = arg_graphics; - -#endif #ifdef A_COLOR @@ -1106,12 +944,6 @@ errr init_gcu(int argc, char **argv) /*** Low level preparation ***/ -#ifdef USE_GETCH - - /* Paranoia -- Assume no waiting */ - nodelay(stdscr, FALSE); - -#endif /* Prepare */ raw(); |