|
|
1.1 root 1: # include "mille.h"
2:
3: /*
4: * @(#)print.c 1.1 (Berkeley) 4/1/82
5: */
6:
7: # define COMP_STRT 20
8: # define CARD_STRT 2
9:
10: prboard() {
11:
12: reg PLAY *pp;
13: reg int i, j, k, temp;
14:
15: for (k = 0; k < 2; k++) {
16: pp = &Player[k];
17: temp = k * COMP_STRT + CARD_STRT;
18: for (i = 0; i < NUM_SAFE; i++)
19: if (pp->safety[i] == S_PLAYED && !pp->sh_safety[i]) {
20: mvaddstr(i, temp, C_name[i + S_CONV]);
21: if (pp->coups[i])
22: mvaddch(i, temp - CARD_STRT, '*');
23: pp->sh_safety[i] = TRUE;
24: }
25: show_card(14, temp, pp->battle, &pp->sh_battle);
26: show_card(16, temp, pp->speed, &pp->sh_speed);
27: for (i = C_25; i <= C_200; i++) {
28: reg char *name;
29: reg int end;
30:
31: if (pp->nummiles[i] == pp->sh_nummiles[i])
32: continue;
33:
34: name = C_name[i];
35: temp = k * 40;
36: end = pp->nummiles[i];
37: for (j = pp->sh_nummiles[i]; j < end; j++)
38: mvwaddstr(Miles, i + 1, (j << 2) + temp, name);
39: pp->sh_nummiles[i] = end;
40: }
41: }
42: prscore(TRUE);
43: temp = CARD_STRT;
44: pp = &Player[PLAYER];
45: for (i = 0; i < HAND_SZ; i++)
46: show_card(i + 6, temp, pp->hand[i], &pp->sh_hand[i]);
47: mvprintw(6, COMP_STRT + CARD_STRT, "%2d", Topcard - Deck);
48: show_card(8, COMP_STRT + CARD_STRT, Discard, &Sh_discard);
49: if (End == 1000) {
50: move(EXT_Y, EXT_X);
51: standout();
52: addstr("Extension");
53: standend();
54: }
55: wrefresh(Board);
56: wrefresh(Miles);
57: wrefresh(Score);
58: }
59:
60: /*
61: * show_card:
62: * Show the given card if it is different from the last one shown
63: */
64: show_card(y, x, c, lc)
65: int y, x;
66: register CARD c, *lc;
67: {
68: if (c == *lc)
69: return;
70:
71: mvprintw(y, x, C_fmt, C_name[c]);
72: *lc = c;
73: }
74:
75: static char Score_fmt[] = "%4d";
76:
77: prscore(for_real)
78: reg bool for_real; {
79:
80: reg PLAY *pp;
81: reg int x;
82:
83: stdscr = Score;
84: for (pp = Player; pp < &Player[2]; pp++) {
85: x = (pp - Player) * 6 + 21;
86: show_score(1, x, pp->mileage, &pp->sh_mileage);
87: if (pp->safescore != pp->sh_safescore) {
88: mvprintw(2, x, Score_fmt, pp->safescore);
89: if (pp->safescore == 400)
90: mvaddstr(3, x + 1, "300");
91: else
92: mvaddstr(3, x + 1, " 0");
93: mvprintw(4, x, Score_fmt, pp->coupscore);
94: pp->sh_safescore = pp->safescore;
95: }
96: if (Window == W_FULL || Finished) {
97: #ifdef EXTRAP
98: if (for_real)
99: finalscore(pp);
100: else
101: extrapolate(pp);
102: #else
103: finalscore(pp);
104: #endif
105: show_score(11, x, pp->hand_tot, &pp->sh_hand_tot);
106: show_score(13, x, pp->total, &pp->sh_total);
107: show_score(14, x, pp->games, &pp->sh_games);
108: }
109: else {
110: show_score(6, x, pp->hand_tot, &pp->sh_hand_tot);
111: show_score(8, x, pp->total, &pp->sh_total);
112: show_score(9, x, pp->games, &pp->sh_games);
113: }
114: }
115: stdscr = Board;
116: }
117:
118: /*
119: * show_score:
120: * Show a score value if it is different from the last time we
121: * showed it.
122: */
123: show_score(y, x, s, ls)
124: int y, x;
125: register int s, *ls;
126: {
127: if (s == *ls)
128: return;
129:
130: mvprintw(y, x, Score_fmt, s);
131: *ls = s;
132: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.