install approved copyright notice
[unix-history] / usr / src / games / sail / pl_2.c
CommitLineData
b5f0675e 1/*
1e008c14 2 * Copyright (c) 1983 Regents of the University of California.
c0ca48ec
KB
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
65c7d3b6
KB
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
b5f0675e
EW
16 */
17
5f9f07ce 18#ifndef lint
65c7d3b6 19static char sccsid[] = "@(#)pl_2.c 5.3 (Berkeley) %G%";
c0ca48ec 20#endif /* not lint */
7fc06086 21
5f9f07ce
CL
22#include "player.h"
23
fe0cae24 24play()
5f9f07ce 25{
fe0cae24 26 register struct ship *sp;
5f9f07ce 27
fe0cae24
EW
28 for (;;) {
29 switch (sgetch("~\b", (struct ship *)0, 0)) {
30 case 'm':
31 acceptmove();
b3a57661 32 break;
fe0cae24
EW
33 case 's':
34 acceptsignal();
b3a57661 35 break;
fe0cae24
EW
36 case 'g':
37 grapungrap();
b3a57661 38 break;
fe0cae24
EW
39 case 'u':
40 unfoulplayer();
b3a57661 41 break;
fe0cae24
EW
42 case 'v':
43 Signal("%s", (struct ship *)0, version);
b3a57661 44 break;
fe0cae24
EW
45 case 'b':
46 acceptboard();
b3a57661 47 break;
fe0cae24
EW
48 case 'f':
49 acceptcombat();
50 break;
51 case 'l':
52 loadplayer();
53 break;
54 case 'c':
55 changesail();
b3a57661
EW
56 break;
57 case 'r':
fe0cae24 58 repair();
b3a57661 59 break;
fe0cae24
EW
60 case 'B':
61 Signal("'Hands to stations!'", (struct ship *)0);
62 unboard(ms, ms, 1); /* cancel DBP's */
63 unboard(ms, ms, 0); /* cancel offense */
b3a57661 64 break;
fe0cae24
EW
65 case '\f':
66 centerview();
490c485f 67 blockalarm();
fe0cae24
EW
68 draw_board();
69 draw_screen();
490c485f 70 unblockalarm();
b3a57661 71 break;
fe0cae24
EW
72 case 'L':
73 mf->loadL = L_EMPTY;
74 mf->loadR = L_EMPTY;
75 mf->readyL = R_EMPTY;
76 mf->readyR = R_EMPTY;
77 Signal("Broadsides unloaded", (struct ship *)0);
78 break;
79 case 'q':
80 Signal("Type 'Q' to quit", (struct ship *)0);
81 break;
82 case 'Q':
83 leave(LEAVE_QUIT);
84 break;
85 case 'I':
86 foreachship(sp)
87 if (sp != ms)
88 eyeball(sp);
89 break;
90 case 'i':
91 if ((sp = closestenemy(ms, 0, 1)) == 0)
92 Signal("No more ships left.");
b3a57661 93 else
fe0cae24 94 eyeball(sp);
b3a57661 95 break;
fe0cae24
EW
96 case 'C':
97 centerview();
490c485f 98 blockalarm();
fe0cae24 99 draw_view();
490c485f 100 unblockalarm();
5f9f07ce 101 break;
fe0cae24
EW
102 case 'U':
103 upview();
490c485f 104 blockalarm();
fe0cae24 105 draw_view();
490c485f 106 unblockalarm();
5f9f07ce 107 break;
fe0cae24
EW
108 case 'D':
109 case 'N':
110 downview();
490c485f 111 blockalarm();
fe0cae24 112 draw_view();
490c485f 113 unblockalarm();
5f9f07ce 114 break;
fe0cae24
EW
115 case 'H':
116 leftview();
490c485f 117 blockalarm();
fe0cae24 118 draw_view();
490c485f 119 unblockalarm();
fe0cae24
EW
120 break;
121 case 'J':
122 rightview();
490c485f 123 blockalarm();
fe0cae24 124 draw_view();
490c485f 125 unblockalarm();
fe0cae24
EW
126 break;
127 case 'F':
128 lookout();
129 break;
130 case 'S':
131 dont_adjust = !dont_adjust;
490c485f 132 blockalarm();
04bbf8e2 133 draw_turn();
490c485f 134 unblockalarm();
5f9f07ce 135 break;
b3a57661 136 }
5f9f07ce 137 }
5f9f07ce 138}