Author: Piotr Krukowiecki vim:ft=diff: Description: patch to display line counter, BTS #304224 Index: netris-0.52/curses.c =================================================================== --- netris-0.52.orig/curses.c +++ netris-0.52/curses.c @@ -258,6 +258,12 @@ ExtFunc void PlotUnderline(int scr, int ExtFunc void ShowDisplayInfo(void) { + if (game == GT_classicTwo) { + move(statusYPos - 5, statusXPos); + printw("Enemy lines: %3d/%4d", enemyLinesCleared, enemyTotalLinesCleared); + } + move(statusYPos - 4, statusXPos); + printw("My lines: %3d/%4d", myLinesCleared, myTotalLinesCleared); move(statusYPos - 3, statusXPos); printw("Won: %3d", won); move(statusYPos - 2, statusXPos); @@ -282,7 +288,7 @@ ExtFunc void ShowDisplayInfo(void) printw("Speed: %dms", speed / 1000); clrtoeol(); if (robotEnable) { - move(statusYPos - 6, statusXPos); + move(statusYPos - 7, statusXPos); if (fairRobot) addstr("Controlled by a fair robot"); else @@ -290,7 +296,7 @@ ExtFunc void ShowDisplayInfo(void) clrtoeol(); } if (opponentFlags & SCF_usingRobot) { - move(statusYPos - 5, statusXPos); + move(statusYPos - 6, statusXPos); if (opponentFlags & SCF_fairRobot) addstr("The opponent is a fair robot"); else Index: netris-0.52/game.c =================================================================== --- netris-0.52.orig/game.c +++ netris-0.52/game.c @@ -103,6 +103,7 @@ ExtFunc void OneGame(int scr, int scr2) int key; char *p, *cmd; + myLinesCleared = enemyLinesCleared = 0; speed = stepDownInterval; ResetBaseTime(); InitBoard(scr); @@ -297,7 +298,15 @@ ExtFunc void OneGame(int scr, int scr2) DropPiece(scr2); break; case NP_clear: - ClearFullLines(scr2); + { + int cleared = ClearFullLines(scr2); + if (cleared) { + enemyLinesCleared += cleared; + enemyTotalLinesCleared += cleared; + ShowDisplayInfo(); + RefreshScreen(); + } + } break; case NP_insertJunk: { @@ -343,7 +352,12 @@ ExtFunc void OneGame(int scr, int scr2) nextPiece: dropMode = 0; FreezePiece(scr); - linesCleared = ClearFullLines(scr); + myLinesCleared += linesCleared = ClearFullLines(scr); + myTotalLinesCleared += linesCleared; + if (linesCleared) { + ShowDisplayInfo(); + RefreshScreen(); + } if (linesCleared > 0 && spied) SendPacket(NP_clear, 0, NULL); if (game == GT_classicTwo && linesCleared > 1) { Index: netris-0.52/netris.h =================================================================== --- netris-0.52.orig/netris.h +++ netris-0.52/netris.h @@ -182,6 +182,11 @@ EXT char scratch[1024]; extern ShapeOption stdOptions[]; extern char *version_string; +EXT int myLinesCleared; +EXT int enemyLinesCleared; +EXT int myTotalLinesCleared; +EXT int enemyTotalLinesCleared; + #include "proto.h" #endif /* NETRIS_H */