1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
Author: Piotr Krukowiecki <piotrwww@krukowiecki.net> vim:ft=diff:
Description: patch to display line counter, BTS #304224
Index: b/curses.c
===================================================================
--- a/curses.c
+++ b/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: b/game.c
===================================================================
--- a/game.c
+++ b/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: b/netris.h
===================================================================
--- a/netris.h
+++ b/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 */
|