Commit | Line | Data |
---|---|---|
5f9f07ce CL |
1 | #ifndef lint |
2 | static char *sccsid = "@(#)pl_2.c 1.1 83/03/17"; | |
3 | #endif | |
4 | #include "player.h" | |
5 | ||
6 | #define turnfirst(buf) (*buf == 'r' || *buf == 'l') | |
7 | ||
8 | lost() | |
9 | { | |
10 | if (scene[game].ship[player].file -> struck) | |
11 | leave(0); | |
12 | if (scene[game].ship[player].file -> captured > -1) | |
13 | leave(1); | |
14 | if (windspeed == 7) | |
15 | leave(3); | |
16 | if(scene[game].ship[player].file -> FS && (!specs[scene[game].ship[player].shipnum].rig1 || windspeed == 6)) | |
17 | Write(FILES + player, 0, 230, 0); | |
18 | } | |
19 | ||
20 | ||
21 | acceptmove(ma, ta, af) | |
22 | int ma, ta, af; | |
23 | { | |
24 | register int n; | |
25 | int moved = 0; | |
26 | int full, vma, dir, ch; | |
27 | char buf[60], last = '\0'; | |
28 | ||
29 | if (scroll >= 22) scroll = 18; | |
30 | move(scroll++, 0); | |
31 | clearline(); | |
32 | printw("move (%d,%c%d): ", ma, (af ? '\'' : ' '), ta); | |
33 | refresh(); | |
34 | n = 0; | |
35 | while((ch = getch()) != '\n'){ | |
36 | if (ch != EOF){ | |
37 | buf[n++] = ch; | |
38 | addch(ch); | |
39 | refresh(); | |
40 | } | |
41 | if(ch == '\b' && n > 1) | |
42 | n -= 2; | |
43 | } | |
44 | buf[n] = '\0'; | |
45 | buf[9] = '\0'; | |
46 | dir = pos[player].dir; | |
47 | vma = ma; | |
48 | for (n = 0; buf[n]; n++) | |
49 | if (!(buf[n] == 'r' || buf[n] == '\n' || buf[n] == 'l' || (buf[n] == '0' && !n) || isdigit(buf[n]) || buf[n] == 'b' || (buf[n] == 'd' && !n))){ | |
50 | if (isspace(buf[n])){ | |
51 | strcpy(buf+n, buf+n+1); | |
52 | n--; | |
53 | } else { | |
54 | Signal("Syntax error.",0,0); | |
55 | buf[n--] = '\0'; | |
56 | } | |
57 | } | |
58 | else | |
59 | switch(buf[n]){ | |
60 | case 'l': | |
61 | dir -= 2; | |
62 | case 'r': | |
63 | dir++; | |
64 | if (!dir) dir = 8; | |
65 | if (dir == 9) dir = 1; | |
66 | if (last == 't'){ | |
67 | Signal("Error; ship can't turn that fast.", 0, 0); | |
68 | buf[n--] = '\0'; | |
69 | } | |
70 | last = 't'; | |
71 | ma--; | |
72 | ta--; | |
73 | vma = min(ma, maxmove(player, dir, 0)); | |
74 | if (ta < 0 && moved || vma < 0 && moved) | |
75 | buf[n--] = '\0'; | |
76 | break; | |
77 | ||
78 | case 'b': | |
79 | ma--; | |
80 | vma--; | |
81 | last = 'b'; | |
82 | if (ta < 0 && moved || vma < 0 && moved) | |
83 | buf[n--] = '\0'; | |
84 | break; | |
85 | ||
86 | case '0': | |
87 | case 'd': | |
88 | buf[n--] = '\0'; | |
89 | break; | |
90 | ||
91 | case '\n': | |
92 | buf[n] = '\0'; | |
93 | break; | |
94 | ||
95 | case '1': | |
96 | case '2': | |
97 | case '3': | |
98 | case '4': | |
99 | case '5': | |
100 | case '6': | |
101 | case '7': | |
102 | if (last == '0'){ | |
103 | Signal("Error; value out of range.", 0, 0); | |
104 | buf[n--] = '\0'; | |
105 | } | |
106 | last = '0'; | |
107 | moved = 1; | |
108 | ma -= buf[n] - '0'; | |
109 | vma -= buf[n] - '0'; | |
110 | if (ta < 0 && moved || vma < 0 && moved) | |
111 | buf[n--] = '\0'; | |
112 | break; | |
113 | ||
114 | } /* end switch and else and for */ | |
115 | if (ta < 0 && moved || vma < 0 && moved || af && turnfirst(buf) && moved){ | |
116 | Signal("Movement error.", 0, 0); | |
117 | if (ta < 0 && moved){ | |
118 | if (scene[game].ship[player].file -> FS == 1){ | |
119 | Write(FILES + player, 0, 230, 0); | |
120 | Signal("No hands to set full sails.", 0, 0); | |
121 | } | |
122 | } | |
123 | else if (ma >= 0) | |
124 | buf[1] = '\0'; | |
125 | } | |
126 | if (af && !moved){ | |
127 | if (scene[game].ship[player].file -> FS == 1){ | |
128 | Write(FILES + player, 0, 230, 0); | |
129 | Signal("No hands to set full sails.", 0, 0); | |
130 | } | |
131 | } | |
132 | strcpy(movebuf, buf); | |
133 | if (!*movebuf) strcpy(movebuf, "d"); | |
134 | Write(FILES + player, 1, 72, movebuf); | |
135 | Signal("Helm: %s.", -1, movebuf); | |
136 | } | |
137 | ||
138 | boarding() | |
139 | { | |
140 | register int n, crew[3]; | |
141 | int captured, men = 0; | |
142 | struct shipspecs *ptr; | |
143 | ||
144 | ptr = &specs[scene[game].ship[player].shipnum]; | |
145 | crew[0] = ptr -> crew1; | |
146 | crew[1] = ptr -> crew2; | |
147 | crew[2] = ptr -> crew3; | |
148 | for(n=0; n < 3; n++){ | |
149 | if (scene[game].ship[player].file -> OBP[n].turnsent) | |
150 | men += scene[game].ship[player].file -> OBP[n].turnsent; | |
151 | } | |
152 | for(n=0; n < 3; n++){ | |
153 | if (scene[game].ship[player].file -> DBP[n].turnsent) | |
154 | men += scene[game].ship[player].file -> DBP[n].turnsent; | |
155 | } | |
156 | if (men){ | |
157 | crew[0] = men/100 ? 0 : crew[0] != 0; | |
158 | crew[1] = (men%100)/10 ? 0 : crew[1] != 0; | |
159 | crew[2] = men%10 ? 0 : crew[2] != 0; | |
160 | } else { | |
161 | crew[0] = crew[0] != 0; | |
162 | crew[1] = crew[1] != 0; | |
163 | crew[2] = crew[2] != 0; | |
164 | } | |
165 | for (n=0; n < scene[game].vessels; n++){ | |
166 | if ((captured = scene[game].ship[n].file -> captured) < 0) | |
167 | captured = n; | |
168 | if (n != player && pos[n].dir && range(player, n) <= 1 && scene[game].ship[player].nationality != scene[game].ship[captured].nationality){ | |
169 | if (meleeing(player, n) && crew[2]){ | |
170 | Signal("How many more to board the %s (%c%c)? ",n,0); | |
171 | parties(crew, n, 200); | |
172 | } | |
173 | else if ((foul(player, n) || grapple(player, n)) && crew[2]){ | |
174 | Signal("Crew sections to board the %s (%c%c) (3 max) ?", n, 0); | |
175 | parties(crew, n, 200); | |
176 | } | |
177 | } | |
178 | } | |
179 | if (crew[2]){ | |
180 | Signal("How many sections to repel boarders? ", 0, 0); | |
181 | parties(crew, player, 260); | |
182 | } | |
183 | } | |
184 | ||
185 | parties(crew, n, offset) | |
186 | int crew[3], n, offset; | |
187 | { | |
188 | register int k, j, men; | |
189 | struct BP * ptr; | |
190 | int buf; | |
191 | int temp[3]; | |
192 | ||
193 | for (k=0; k < 3; k++) | |
194 | temp[k] = crew[k]; | |
195 | while((buf = getch()) == EOF); | |
196 | addch(buf); | |
197 | if (isdigit(buf)){ | |
198 | ptr = offset == 200 ? scene[game].ship[player].file -> OBP : scene[game].ship[player].file -> DBP ; | |
199 | for (j = 0; j < 3 && ptr[j].turnsent; j++); | |
200 | if (!ptr[j].turnsent && buf > '0'){ | |
201 | men = 0; | |
202 | for (k=0; k < 3 && buf > '0'; k++){ | |
203 | men += crew[k]*power(10, 2-k); | |
204 | crew[k] = 0; | |
205 | if (men) buf -= 1; | |
206 | } | |
207 | if (buf > '0') | |
208 | Signal("Sending all crew sections.", 0, 0); | |
209 | Write(FILES + player, 0, 30 + (offset > 200)*18 + 6*j, turn); | |
210 | Write(FILES + player, 0, 30 + (offset > 200)*18 + 6*j + 2, n); | |
211 | Write(FILES + player, 0, 30 + (offset > 200)*18 + 6*j + 4, men); | |
212 | switch(offset){ | |
213 | case 200: | |
214 | wmove(slot, 0, 0); | |
215 | for (k=0; k < 3; k++) | |
216 | if (temp[k] && !crew[k]) | |
217 | waddch(slot, k + '1'); | |
218 | else | |
219 | wmove(slot, 0, 1 + k); | |
220 | wmove(slot, 1, 0); | |
221 | waddstr(slot, "OBP"); | |
222 | makesignal("boarding the %s (%c%c)", n, player); | |
223 | break; | |
224 | case 260: | |
225 | wmove(slot, 2, 0); | |
226 | for (k=0; k < 3; k++) | |
227 | if (temp[k] && !crew[k]) | |
228 | waddch(slot, k + '1'); | |
229 | else | |
230 | wmove(slot, 2, 1 + k); | |
231 | wmove(slot, 3, 0); | |
232 | waddstr(slot, "DBP"); | |
233 | makesignal("repelling boarders", 0, player); | |
234 | break; | |
235 | } | |
236 | wrefresh(slot); | |
237 | } | |
238 | else | |
239 | Signal("Sending no crew sections.", 0, 0); | |
240 | } | |
241 | } | |
242 | ||
243 | power(base, exp) | |
244 | int base, exp; | |
245 | { | |
246 | switch(exp){ | |
247 | case 0: | |
248 | return(1); | |
249 | case 1: | |
250 | return(base); | |
251 | case 2: | |
252 | return(base * base); | |
253 | } | |
254 | return(0); | |
255 | } | |
256 | ||
257 | repair() | |
258 | { | |
259 | int buf; | |
260 | int *repairs; | |
261 | struct shipspecs *ptr; | |
262 | ||
263 | if (!repaired && !loaded && !fired && !changed && !turned()){ | |
264 | ptr = &specs[scene[game].ship[player].shipnum]; | |
265 | Signal("Repair (hull, guns, rigging)? ", 0, 0); | |
266 | while((buf = getch()) == EOF); | |
267 | addch(buf); | |
268 | switch(buf){ | |
269 | case 'h': | |
270 | repairs = &scene[game].ship[player].file -> RH; | |
271 | break; | |
272 | case 'g': | |
273 | repairs = &scene[game].ship[player].file -> RG; | |
274 | break; | |
275 | case 'r': | |
276 | repairs = &scene[game].ship[player].file -> RR; | |
277 | break; | |
278 | default: | |
279 | Signal("Avast heaving!", 0, 0); | |
280 | return; | |
281 | } | |
282 | repaired = 1; | |
283 | *repairs += 1; | |
284 | if (*repairs >= 3){ | |
285 | *repairs = 0; | |
286 | } | |
287 | if (!*repairs){ | |
288 | switch(buf){ | |
289 | case 'h': | |
290 | if (ptr -> hull < ptr -> guns/4) | |
291 | Write(SPECS + player, 0, 10, ptr -> hull + 2); | |
292 | else buf = 0; | |
293 | break; | |
294 | case 'g': | |
295 | if (ptr -> gunL < ptr -> gunR){ | |
296 | if (ptr -> gunL + ptr -> carL < ptr -> guns/5) | |
297 | Write(SPECS + player, 0, 20, ptr -> gunL + 2); | |
298 | else buf = 0; | |
299 | } else | |
300 | if (ptr -> gunR + ptr -> carR < ptr -> guns/5) | |
301 | Write(SPECS + player, 0, 22, ptr -> gunR + 2); | |
302 | else buf = 0; | |
303 | break; | |
304 | case 'r': | |
305 | if (!ptr -> rig4) | |
306 | Write(SPECS + player, 0, 34, ptr -> rig4 + 2); | |
307 | else if (!ptr -> rig3) | |
308 | Write(SPECS + player, 0, 32, 2); | |
309 | else if (!ptr -> rig2) | |
310 | Write(SPECS + player, 0, 30, 2); | |
311 | else if (ptr -> rig1 < 4) | |
312 | Write(SPECS + player, 0, 28, 2); | |
313 | else buf = 0; | |
314 | break; | |
315 | } | |
316 | if (!buf) | |
317 | Signal("Repairs completed.", 0, 0); | |
318 | } | |
319 | } | |
320 | else | |
321 | Signal("No hands free to repair",0,0); | |
322 | } | |
323 | ||
324 | turned() | |
325 | { | |
326 | register int n; | |
327 | ||
328 | for (n=0; movebuf[n]; n++) | |
329 | if (movebuf[n] == 'r' || movebuf[n] == 'l') | |
330 | return(1); | |
331 | return(0); | |
332 | } | |
333 | ||
334 | loadplayer() | |
335 | { | |
336 | int buf; | |
337 | int loadL, loadR, ready, load, *Ready, *Load; | |
338 | ||
339 | if (!specs[scene[game].ship[player].shipnum].crew3){ | |
340 | Signal("out of crew",0,0); | |
341 | return(0); | |
342 | } | |
343 | Load = &scene[game].ship[player].file -> loadL; | |
344 | Ready = &scene[game].ship[player].file -> readyL; | |
345 | loadL = *Load; | |
346 | loadR = *(Load + 1); | |
347 | if (!loadL && !loadR){ | |
348 | Signal("Load which broadside (left or right)? ", 0, 0); | |
349 | while((buf = getch()) == EOF); | |
350 | addch(buf); | |
351 | if (buf == 'r') | |
352 | loadL = 1; | |
353 | else | |
354 | loadR = 1; | |
355 | } | |
356 | if ((!loadL && loadR || loadL && !loadR)){ | |
357 | Signal("Reload with (round, double, chain, grape)? ", 0, 0); | |
358 | while((buf = getch()) == EOF); | |
359 | addch(buf); | |
360 | switch(buf){ | |
361 | case 'r': | |
362 | load = ROUND; | |
363 | ready = 1; | |
364 | break; | |
365 | case 'd': | |
366 | load = DOUBLE; | |
367 | ready = 2; | |
368 | break; | |
369 | case 'c': | |
370 | load = CHAIN; | |
371 | ready = 1; | |
372 | break; | |
373 | case 'g': | |
374 | load = GRAPE; | |
375 | ready = 1; | |
376 | break; | |
377 | default: | |
378 | Signal("Broadside not loaded.", 0, 0); | |
379 | return; | |
380 | } | |
381 | if (!loadR){ | |
382 | *(Load + 1) = load; | |
383 | *(Ready + 1) = ready; | |
384 | } | |
385 | else { | |
386 | *Load = load; | |
387 | *Ready = ready; | |
388 | } | |
389 | loaded = 1; | |
390 | } | |
391 | } | |
392 | ||
393 | changesail() | |
394 | { | |
395 | int buf; | |
396 | int rig, full; | |
397 | ||
398 | rig = specs[scene[game].ship[player].shipnum].rig1; | |
399 | full = scene[game].ship[player].file -> FS; | |
400 | if ((windspeed == 6) || (windspeed == 5 && specs[scene[game].ship[player].shipnum].class > 4)) | |
401 | rig = 0; | |
402 | if (specs[scene[game].ship[player].shipnum].crew3 && rig){ | |
403 | if (!full){ | |
404 | Signal("Increase to Full sails? ", 0, 0); | |
405 | while((buf = getch()) == EOF); | |
406 | addch(buf); | |
407 | if (buf == 'y'){ | |
408 | changed = 1; | |
409 | Write(FILES + player, 0, 230, 1); | |
410 | } | |
411 | } | |
412 | else { | |
413 | Signal("Reduce to Battle sails? ", 0, 0); | |
414 | while((buf = getch()) == EOF); | |
415 | addch(buf); | |
416 | if (buf == 'y'){ | |
417 | Write(FILES + player, 0, 230, 0); | |
418 | changed = 1; | |
419 | } | |
420 | } | |
421 | } | |
422 | else if (!rig) | |
423 | Signal("Sails rent to pieces",0,0); | |
424 | } | |
425 | ||
426 | ||
427 | signalflags() | |
428 | { | |
429 | register int n; | |
430 | ||
431 | for(n=0; n < scene[game].vessels; n++){ | |
432 | if (*scene[game].ship[n].file -> signal){ | |
433 | putchar('\7'); | |
434 | Signal("%s (%c%c): %s",n,scene[game].ship[n].file -> signal); | |
435 | *scene[game].ship[n].file -> signal = '\0'; | |
436 | } | |
437 | } | |
438 | } | |
439 | ||
440 | iplotships() /* new turn; also plot-ships */ | |
441 | { | |
442 | repaired = loaded = fired = changed = 0; | |
443 | plotships(); | |
444 | } | |
445 | ||
446 | ||
447 | plotships() /* uses ken's package */ | |
448 | { | |
449 | register int n; | |
450 | char ch; | |
451 | int sternr,sternc; | |
452 | ||
453 | getyx(stdscr, ylast, xlast); | |
454 | screen(); | |
455 | readpos(); | |
456 | werase(view); | |
457 | if (pos[player].row < viewrow + 5) | |
458 | viewrow = pos[player].row - ROWSINVIEW + 5; | |
459 | else if (pos[player].row > viewrow + ROWSINVIEW - 5) | |
460 | viewrow = pos[player].row - 5; | |
461 | if (pos[player].col < viewcol + 10) | |
462 | viewcol = pos[player].col - COLSINVIEW + 10; | |
463 | else if (pos[player].col > viewcol + COLSINVIEW - 10) | |
464 | viewcol = pos[player].col - 10; | |
465 | for (n=0; n < scene[game].vessels; n++) | |
466 | if (pos[n].dir && pos[n].row > viewrow && pos[n].row < viewrow + ROWSINVIEW && pos[n].col > viewcol && pos[n].col < viewcol + COLSINVIEW){ | |
467 | wmove(view, pos[n].row - viewrow, pos[n].col - viewcol); | |
468 | waddch(view, colours(n)); | |
469 | ch = sterncolor(n, &sternr, &sternc); | |
470 | wmove(view, sternr - viewrow, sternc - viewcol); | |
471 | waddch(view, ch); | |
472 | } | |
473 | wrefresh(view); | |
474 | move(ylast, xlast); | |
475 | refresh(); | |
476 | } | |
477 | ||
478 | acceptsignal() | |
479 | { | |
480 | int ch; | |
481 | char buf[60]; | |
482 | register int n; | |
483 | ||
484 | if(scroll == 23) scroll = 18; | |
485 | Signal("Message? ",0,0); | |
486 | buf[0] = 34; | |
487 | n = 1; | |
488 | while((ch = getch()) != '\n'){ | |
489 | if (ch != EOF){ | |
490 | buf[n++] = ch; | |
491 | addch(ch); | |
492 | refresh(); | |
493 | } | |
494 | if (ch == '\b' && n > 1) | |
495 | n -= 2; | |
496 | } | |
497 | buf[n] = 34; | |
498 | buf[n+1] = '\0'; | |
499 | buf[59] = '\0'; | |
500 | Write(FILES + player, 1, 164, buf); | |
501 | } | |
502 | ||
503 | ||
504 | board() | |
505 | { | |
506 | register int n; | |
507 | char *name; | |
508 | int class, junk; | |
509 | ||
510 | clear(); | |
511 | werase(view); | |
512 | werase(slot); | |
513 | move(1,0); | |
514 | for (n=0; n < 80; n++) | |
515 | addch('-'); | |
516 | move(17,0); | |
517 | for (n=0; n < 80; n++) | |
518 | addch('-'); | |
519 | for (n=2; n < 17; n++){ | |
520 | mvaddch(n, 0,'|'); | |
521 | mvaddch(n, 79, '|'); | |
522 | } | |
523 | mvaddch(1,0,'+'); | |
524 | mvaddch(17,0,'+'); | |
525 | mvaddch(1,79,'+'); | |
526 | mvaddch(17,79,'+'); | |
527 | wmove(view, 2, 27); | |
528 | waddstr(view, "Wooden Ships & Iron Men"); | |
529 | wmove(view, 4, (77 - lengthof(scene[game].name))/2); | |
530 | waddstr(view, scene[game].name); | |
531 | refresh(); | |
532 | wrefresh(view); | |
533 | switch((class = specs[scene[game].ship[player].shipnum].class)){ | |
534 | case 2: | |
535 | case 1: | |
536 | name = "SOL"; | |
537 | break; | |
538 | case 3: | |
539 | case 4: | |
540 | name = "Frigate"; | |
541 | break; | |
542 | case 5: | |
543 | case 6: | |
544 | name = "Sloop"; | |
545 | break; | |
546 | } | |
547 | move(0,0); | |
548 | printw("Class %d %s (%d guns) '%s' (%c%c)", class, name, specs[scene[game].ship[player].shipnum].guns, scene[game].ship[player].shipname, colours(player), sterncolor(player, &junk, &junk)); | |
549 | } | |
550 | ||
551 | clearline() | |
552 | { | |
553 | register int n; | |
554 | ||
555 | move(scroll-1, 0); | |
556 | for (n=0; n < 59; n++) | |
557 | addch(' '); | |
558 | move(scroll-1, 0); | |
559 | } | |
560 | ||
561 | ||
562 | ||
563 | Signal(fmt, shipnum, string) | |
564 | int shipnum; | |
565 | char *fmt, *string; | |
566 | { | |
567 | int junk; | |
568 | ||
569 | move(scroll++, 0); | |
570 | clearline(); | |
571 | if (scroll > 23) scroll = 18; | |
572 | if (shipnum == -1) | |
573 | printw(fmt, string); | |
574 | else if (*string == '*') | |
575 | printw(fmt, "computer", '0','0', string); | |
576 | else | |
577 | printw(fmt, scene[game].ship[shipnum].shipname, colours(shipnum), sterncolor(shipnum, &junk, &junk), string); | |
578 | refresh(); | |
579 | } | |
580 | ||
581 | char *quality(shipnum) | |
582 | int shipnum; | |
583 | { | |
584 | switch(specs[scene[game].ship[shipnum].shipnum].qual){ | |
585 | ||
586 | case 5: | |
587 | return("elite"); | |
588 | case 4: | |
589 | return("crack"); | |
590 | case 3: | |
591 | return("mundane"); | |
592 | case 2: | |
593 | return("green"); | |
594 | case 1: | |
595 | return("mutinous"); | |
596 | } | |
597 | } | |
598 | ||
599 | char *info(ship, final) | |
600 | int ship; | |
601 | char *final; | |
602 | { | |
603 | sprintf(final, "%d gun \0", specs[scene[game].ship[ship].shipnum].guns); | |
604 | switch(specs[scene[game].ship[ship].shipnum].class){ | |
605 | case 1: | |
606 | case 2: | |
607 | strcat(final, "Ship of the Line"); | |
608 | break; | |
609 | case 3: | |
610 | strcat(final, "Frigate"); | |
611 | break; | |
612 | case 4: | |
613 | strcat(final, "Corvette"); | |
614 | break; | |
615 | case 5: | |
616 | strcat(final, "Sloop"); | |
617 | break; | |
618 | case 6: | |
619 | strcat(final, "Brig"); | |
620 | break; | |
621 | } | |
622 | return(final); | |
623 | } | |
624 | ||
625 | screen() | |
626 | { | |
627 | int class; | |
628 | register int n; | |
629 | int dr = 0, dc = 0; | |
630 | struct shipspecs *data; | |
631 | struct File *ptr; | |
632 | ||
633 | scene[game].ship[player].file -> readyL--; | |
634 | scene[game].ship[player].file -> readyR--; | |
635 | movebuf[0] = '\0'; | |
636 | sync(); | |
637 | if (turn % 50 == 0) | |
638 | Write(SCENARIO, 0, 10, 1); /* still playing */ | |
639 | windspeed = scene[game].windspeed; | |
640 | winddir = scene[game].winddir; | |
641 | turn = scene[game].turn; | |
642 | move(0, 47); | |
643 | ptr = scene[game].ship[player].file; | |
644 | data = &specs[scene[game].ship[player].shipnum]; | |
645 | if (ptr -> FS == 1) | |
646 | Write(FILES + player, 0, 230, 2); | |
647 | printw("Points:%3d Fouls:%2d Grapples:%2d",ptr -> points, fouled(player), grappled(player)); | |
648 | move(17, 36); | |
649 | printw("Turn %d", turn); | |
650 | move(18, 59); | |
651 | printw("Load %c%c %c%c", symbol(ptr -> loadL), iinitial(ptr -> readyL), symbol(ptr -> loadR), iinitial(ptr -> readyR)); | |
652 | move(19, 59); | |
653 | printw("Hull %2d", data -> hull); | |
654 | move(20, 59); | |
655 | printw("Crew %2d %2d %2d", data -> crew1, data -> crew2, data -> crew3); | |
656 | move(21, 59); | |
657 | printw("Guns %2d %2d", data -> gunL, data -> gunR); | |
658 | move(22, 59); | |
659 | printw("Carr %2d %2d", data -> carR, data -> carL); | |
660 | move(23, 59); | |
661 | printw("Rigg %d %d %d ", data -> rig1, data -> rig2, data -> rig3); | |
662 | if (data -> rig4 < 0) | |
663 | addch('-'); | |
664 | else | |
665 | printw("%d", data -> rig4); | |
666 | move(18, 74); | |
667 | printw("0 %d(%d)", maxmove(player, winddir + 3, -1), maxmove(player, winddir + 3, 1)); | |
668 | move(19, 73); | |
669 | addstr("\\|/"); | |
670 | move(20, 73); | |
671 | printw("-^-%d(%d)", maxmove(player, winddir + 2, -1), maxmove(player, winddir + 2, 1)); | |
672 | move(21, 73); | |
673 | addstr("/|\\"); | |
674 | move(22, 74); | |
675 | printw("| %d(%d)", maxmove(player, winddir + 1, -1), maxmove(player, winddir + 1, 1)); | |
676 | move(23, 73); | |
677 | printw("%d(%d)", maxmove(player, winddir, -1), maxmove(player, winddir, 1)); | |
678 | refresh(); | |
679 | if (!boarders(player, 0)){ | |
680 | wmove(slot, 0, 0); | |
681 | waddstr(slot, " "); | |
682 | wmove(slot, 1, 0); | |
683 | waddstr(slot, " "); | |
684 | } else { | |
685 | wmove(slot, 1, 0); | |
686 | waddstr(slot, "OBP"); | |
687 | } | |
688 | if (!boarders(player, 1)){ | |
689 | wmove(slot, 2, 0); | |
690 | waddstr(slot, " "); | |
691 | wmove(slot, 3, 0); | |
692 | waddstr(slot, " "); | |
693 | } else { | |
694 | wmove(slot, 3, 0); | |
695 | waddstr(slot, "DBP"); | |
696 | } | |
697 | wmove(slot, 12, 0); | |
698 | if (n = scene[game].ship[player].file -> RH) | |
699 | wprintw(slot, "%dRH", n); | |
700 | else | |
701 | waddstr(slot, " "); | |
702 | wmove(slot, 13, 0); | |
703 | if (n = scene[game].ship[player].file -> RG) | |
704 | wprintw(slot, "%dRG", n); | |
705 | else | |
706 | waddstr(slot, " "); | |
707 | wmove(slot, 14, 0); | |
708 | if (n = scene[game].ship[player].file -> RR) | |
709 | wprintw(slot, "%dRR", n); | |
710 | else | |
711 | waddstr(slot, " "); | |
712 | wmove(slot, 7, 1); | |
713 | wprintw(slot,"%d", windspeed); | |
714 | drdc(&dr, &dc, winddir); | |
715 | wmove(slot, 7, 0); waddch(slot, ' '); | |
716 | wmove(slot, 7, 2); waddch(slot, ' '); | |
717 | wmove(slot, 6, 0); waddch(slot, ' '); | |
718 | wmove(slot, 6, 1); waddch(slot, ' '); | |
719 | wmove(slot, 6, 2); waddch(slot, ' '); | |
720 | wmove(slot, 8, 0); waddch(slot, ' '); | |
721 | wmove(slot, 8, 1); waddch(slot, ' '); | |
722 | wmove(slot, 8, 2); waddch(slot, ' '); | |
723 | wmove(slot, (7 - dr), (1 - dc)); | |
724 | switch(winddir){ | |
725 | case 1: | |
726 | case 5: | |
727 | waddch(slot, '|'); | |
728 | break; | |
729 | case 2: | |
730 | case 6: | |
731 | waddch(slot, '/'); | |
732 | break; | |
733 | case 3: | |
734 | case 7: | |
735 | waddch(slot, '-'); | |
736 | break; | |
737 | case 4: | |
738 | case 8: | |
739 | waddch(slot, '\\'); | |
740 | break; | |
741 | } | |
742 | wmove(slot, (7 + dr), (1 + dc)); | |
743 | waddch(slot, '+'); | |
744 | wrefresh(slot); | |
745 | signal(SIGALRM, iplotships); /* new turn and plot-ships */ | |
746 | alarm(7); | |
747 | } | |
748 | ||
749 | extern char iinitial(ready) | |
750 | int ready; | |
751 | { | |
752 | if (ready <= -30000) | |
753 | return('!'); | |
754 | if (ready > 0) | |
755 | return('*'); | |
756 | return(' '); | |
757 | } | |
758 | ||
759 | char symbol(number) | |
760 | int number; | |
761 | { | |
762 | switch(number){ | |
763 | case GRAPE: | |
764 | return('G'); | |
765 | case ROUND: | |
766 | return('R'); | |
767 | case DOUBLE: | |
768 | return('D'); | |
769 | case CHAIN: | |
770 | return('C'); | |
771 | } | |
772 | return('-'); | |
773 | } | |
774 |