home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume4 / sail / part03 / pl_2.c < prev    next >
C/C++ Source or Header  |  1988-04-13  |  3KB  |  134 lines

  1. /*
  2.  * Copyright (c) 1983 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that this notice is preserved and that due credit is given
  7.  * to the University of California at Berkeley. The name of the University
  8.  * may not be used to endorse or promote products derived from this
  9.  * software without specific prior written permission. This software
  10.  * is provided ``as is'' without express or implied warranty.
  11.  */
  12.  
  13. #ifndef lint
  14. static char sccsid[] = "@(#)pl_2.c    5.2 (Berkeley) 3/9/88";
  15. #endif /* not lint */
  16.  
  17. #include "player.h"
  18.  
  19. play()
  20. {
  21.     register struct ship *sp;
  22.  
  23.     for (;;) {
  24.         switch (sgetch("~\b", (struct ship *)0, 0)) {
  25.         case 'm':
  26.             acceptmove();
  27.             break;
  28.         case 's':
  29.             acceptsignal();
  30.             break;
  31.         case 'g':
  32.             grapungrap();
  33.             break;
  34.         case 'u':
  35.             unfoulplayer();
  36.             break;
  37.         case 'v':
  38.             Signal("%s", (struct ship *)0, version);
  39.             break;
  40.         case 'b':
  41.             acceptboard();
  42.             break;
  43.         case 'f':
  44.             acceptcombat();
  45.             break;
  46.         case 'l':
  47.             loadplayer();
  48.             break;
  49.         case 'c':
  50.             changesail();
  51.             break;
  52.         case 'r':
  53.             repair();
  54.             break;
  55.         case 'B':
  56.             Signal("'Hands to stations!'", (struct ship *)0);
  57.             unboard(ms, ms, 1);    /* cancel DBP's */
  58.             unboard(ms, ms, 0);    /* cancel offense */
  59.             break;
  60.         case '\f':
  61.             centerview();
  62.             blockalarm();
  63.             draw_board();
  64.             draw_screen();
  65.             unblockalarm();
  66.             break;
  67.         case 'L':
  68.             mf->loadL = L_EMPTY;
  69.             mf->loadR = L_EMPTY;
  70.             mf->readyL = R_EMPTY;
  71.             mf->readyR = R_EMPTY;
  72.             Signal("Broadsides unloaded", (struct ship *)0);
  73.             break;
  74.         case 'q':
  75.             Signal("Type 'Q' to quit", (struct ship *)0);
  76.             break;
  77.         case 'Q':
  78.             leave(LEAVE_QUIT);
  79.             break;
  80.         case 'I':
  81.             foreachship(sp)
  82.                 if (sp != ms)
  83.                     eyeball(sp);
  84.             break;
  85.         case 'i':
  86.             if ((sp = closestenemy(ms, 0, 1)) == 0)
  87.                 Signal("No more ships left.");
  88.             else
  89.                 eyeball(sp);
  90.             break;
  91.         case 'C':
  92.             centerview();
  93.             blockalarm();
  94.             draw_view();
  95.             unblockalarm();
  96.             break;
  97.         case 'U':
  98.             upview();
  99.             blockalarm();
  100.             draw_view();
  101.             unblockalarm();
  102.             break;
  103.         case 'D':
  104.         case 'N':
  105.             downview();
  106.             blockalarm();
  107.             draw_view();
  108.             unblockalarm();
  109.             break;
  110.         case 'H':
  111.             leftview();
  112.             blockalarm();
  113.             draw_view();
  114.             unblockalarm();
  115.             break;
  116.         case 'J':
  117.             rightview();
  118.             blockalarm();
  119.             draw_view();
  120.             unblockalarm();
  121.             break;
  122.         case 'F':
  123.             lookout();
  124.             break;
  125.         case 'S':
  126.             dont_adjust = !dont_adjust;
  127.             blockalarm();
  128.             draw_turn();
  129.             unblockalarm();
  130.             break;
  131.         }
  132.     }
  133. }
  134.