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