home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / TOP / USR / SRC / yahtzee.t.Z / yahtzee.t / misc.c < prev    next >
Text File  |  1988-07-28  |  1KB  |  76 lines

  1. /* misc.c
  2.  *    various miscellaneous routines.
  3.  */
  4. #include <curses.h>
  5. #include <signal.h>
  6. #include "defs.h"
  7. #include "side.h"
  8.  
  9. /* gets called on interrupts */
  10. byebye()
  11.     {
  12.     dis_score((WINDOW *) 0);
  13.     yahtzee_exit(0);
  14.     }
  15.  
  16. /* display categories */
  17. dis_side()
  18.  
  19.     {
  20.     int i;
  21.  
  22.     for (i = 0; i < sidey; ++i)
  23.         mvwaddstr(screen, i + top, 0, side[i]);
  24.     }
  25.  
  26. /* general purpose exit routine */
  27. int yahtzee_exit(status)
  28.  
  29. int status;
  30.  
  31.     {
  32. #ifdef BSD
  33.     wmove(screen, 23, 0);
  34.     wrefresh(screen);
  35. #endif
  36.     nocrmode();
  37.     echo();
  38.     endwin();
  39.     exit(status);
  40.     }
  41.  
  42. /* redraw a window in cases where garbage hits the screen */
  43. redraw(win)
  44.  
  45. WINDOW *win;
  46.  
  47.     {
  48.     clear();
  49.     refresh();
  50.     touchwin(win);
  51.     wrefresh(win);
  52.     return(0);
  53.     }
  54.  
  55. static char versionID[] =
  56.     {"yahtzee V1.0 Beta - Stacey Campbell - {utzoo,utcsri}!hcr!stacey"};
  57.  
  58. version(back_window)
  59.  
  60. WINDOW *back_window;
  61.  
  62.     {
  63.     WINDOW *v_window;
  64.     int mess_len = strlen(versionID) + 3;
  65.  
  66.     v_window = newwin(3, mess_len, 11, (COLS - mess_len) / 2);
  67.     BoxUp(v_window, 3, mess_len);
  68.     mvwaddstr(v_window, 1, 1, versionID);
  69.     touchwin(v_window);
  70.     wrefresh(v_window);
  71.     sleep(3);
  72.     touchwin(back_window);
  73.     wrefresh(back_window);
  74.     delwin(v_window);
  75.     }
  76.