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