-}
-
-ExtFunc void ShowDisplayInfo(void)
-{
- move(statusYPos - 9, statusXPos);
- printw("Seed: %d", initSeed);
- clrtoeol();
- move(statusYPos - 8, statusXPos);
- printw("Speed: %dms", speed / 1000);
- clrtoeol();
- if (robotEnable) {
- move(statusYPos - 6, statusXPos);
- if (fairRobot)
- addstr("Controlled by a fair robot");
- else
- addstr("Controlled by a robot");
- clrtoeol();
- }
- if (opponentFlags & SCF_usingRobot) {
- move(statusYPos - 5, statusXPos);
- if (opponentFlags & SCF_fairRobot)
- addstr("The opponent is a fair robot");
- else
- addstr("The opponent is a robot");
- clrtoeol();
- }
-}
-
-ExtFunc void UpdateOpponentDisplay(void)
-{
- move(1, 0);
- printw("Playing %s@%s", opponentName, opponentHost);
- clrtoeol();
-}
-
-ExtFunc void ShowPause(int pausedByMe, int pausedByThem)
-{
- move(statusYPos - 3, statusXPos);
- if (pausedByThem)
- addstr("Game paused by opponent");
- else
- clrtoeol();
- move(statusYPos - 2, statusXPos);
- if (pausedByMe)
- addstr("Game paused by you");
- else
- clrtoeol();
-}
-
-ExtFunc void Message(char *s)
-{
- static int line = 0;
-
- move(statusYPos - 20 + line, statusXPos);
- addstr(s); /* XXX Should truncate long lines */
- clrtoeol();
- line = (line + 1) % 10;
- move(statusYPos - 20 + line, statusXPos);
- clrtoeol();
-}
-
-ExtFunc void RefreshScreen(void)
-{
- static char timeStr[2][32];
- time_t theTime;
-
- time(&theTime);
- strftime(timeStr[0], 30, "%I:%M %p", localtime(&theTime));
- /* Just in case the local curses library sucks */
- if (strcmp(timeStr[0], timeStr[1]))
- {
- move(statusYPos, statusXPos);
- addstr(timeStr[0]);
- strcpy(timeStr[1], timeStr[0]);
- }
- move(boardYPos[0] + 1, boardXPos[0] + 2 * boardWidth[0] + 1);
- refresh();
-}
+ else {
+ addch(flag ? ACS_BTEE : ACS_HLINE);
+ addch(flag ? ACS_BTEE : ACS_HLINE);
+ } //ncurses graphics
+} //PlotUnderline
+
+ExtFunc void ShowScore(int scr, struct _Score score)
+{ //show score stuff
+ float timer;
+
+ mvaddstr(13, statusXPos, "next ");
+ mvaddstr(14, statusXPos + 5, " ");
+ ShapeIterate(Players[scr].nextShape, scr,
+ ShapeToNetNum(Players[scr].nextShape) == 15 ? 6 : 7,
+ statusXPos / 2 + 4, 1, GlanceFunc, NULL);
+ mvprintw(3, statusXPos, "level %5d", score.level);
+ mvprintw(5, statusXPos, "score%8d", score.score);
+ mvprintw(6, statusXPos, "lines%8d", score.lines);
+ timer = CurTimeval() / 1e6;
+ if (timer > 4) {
+ mvprintw(9, statusXPos, "ppm %9.1f", score.drops * 60 / timer);
+ if (score.lines > 0) {
+ mvprintw(7, statusXPos,
+ "yield %3d%%", 100 * score.adds / score.lines);
+ mvprintw(10, statusXPos, "apm %9.1f", score.adds * 60 / timer);
+ }
+ } //display [ap]pm
+ else {
+ int i;
+ for (i = 7; i <= 10; i++)
+ mvaddstr(i, statusXPos, " ");
+ } //too early to display stats, remove old..
+} //ShowScore
+
+ExtFunc void FieldMessage(int playa, char *message)
+{ //put a message over playa's field
+ if (!Players[playa].spy) return;
+ if (message) {
+ char s[MAX_BOARD_WIDTH+1];
+ memset(s, ' ', MAX_BOARD_WIDTH);
+ memcpy(&s[Players[playa].boardWidth - strlen(message) / 2],
+ message, strlen(message));
+ s[Players[playa].boardWidth * 2] = 0;
+#ifdef HAVE_NCURSES
+ attrset(A_REVERSE);
+#else
+ standout();
+#endif
+ mvprintw(boardYPos[playa] - Players[playa].boardVisible / 2,
+ boardXPos[playa], "%s", s);
+ standend();
+ } //display
+ else {
+ int x, y;
+ y = Players[playa].boardVisible / 2;
+ for (x = 0; x <= Players[playa].boardWidth; x++)
+ PlotBlock(playa, y, x, GetBlock(playa, y, x));
+ } //restore field
+} //FieldMessage
+
+ExtFunc void ShowPause(int playa)
+{ //put paused over player's field
+ if (Players[playa].alive)
+ if (Players[playa].flags & SCF_paused)
+ FieldMessage(playa, Game.started > 1
+ ? "P A U S E D" : "N O T R E A D Y");
+ else FieldMessage(playa, Game.started > 1 ? NULL : "R E A D Y");
+ else FieldMessage(playa, playa > maxPlayer
+ ? "E M P T Y" : "G A M E O V E R");
+} //ShowPause
+
+
+ExtFunc void ShowTime(void)
+{ //display timer
+ mvprintw(statusYPos, statusXPos, "timer %7.0f ", CurTimeval() / 1e6);
+// move(boardYPos[0] + 1, boardXPos[0] + 2 * Players[0].boardWidth + 1);
+// refresh();
+} //ShowTime