|
|
1.1 root 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: (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
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
17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: */
19:
20: #ifndef lint
21: static char sccsid[] = "@(#)pl_2.c 5.4 (Berkeley) 6/1/90";
22: #endif /* not lint */
23:
24: #include "player.h"
25:
26: play()
27: {
28: register struct ship *sp;
29:
30: for (;;) {
31: switch (sgetch("~\b", (struct ship *)0, 0)) {
32: case 'm':
33: acceptmove();
34: break;
35: case 's':
36: acceptsignal();
37: break;
38: case 'g':
39: grapungrap();
40: break;
41: case 'u':
42: unfoulplayer();
43: break;
44: case 'v':
45: Signal("%s", (struct ship *)0, version);
46: break;
47: case 'b':
48: acceptboard();
49: break;
50: case 'f':
51: acceptcombat();
52: break;
53: case 'l':
54: loadplayer();
55: break;
56: case 'c':
57: changesail();
58: break;
59: case 'r':
60: repair();
61: break;
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 */
66: break;
67: case '\f':
68: centerview();
69: blockalarm();
70: draw_board();
71: draw_screen();
72: unblockalarm();
73: break;
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.");
95: else
96: eyeball(sp);
97: break;
98: case 'C':
99: centerview();
100: blockalarm();
101: draw_view();
102: unblockalarm();
103: break;
104: case 'U':
105: upview();
106: blockalarm();
107: draw_view();
108: unblockalarm();
109: break;
110: case 'D':
111: case 'N':
112: downview();
113: blockalarm();
114: draw_view();
115: unblockalarm();
116: break;
117: case 'H':
118: leftview();
119: blockalarm();
120: draw_view();
121: unblockalarm();
122: break;
123: case 'J':
124: rightview();
125: blockalarm();
126: draw_view();
127: unblockalarm();
128: break;
129: case 'F':
130: lookout();
131: break;
132: case 'S':
133: dont_adjust = !dont_adjust;
134: blockalarm();
135: draw_turn();
136: unblockalarm();
137: break;
138: }
139: }
140: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.