Package: netris
Version: 0.52-3
Severity: wishlist
Tags: patch

Hello

I've made a patch that adds 2 lines to the display:
Enemy lines:   x1/y1
My lines:      x2/y2
where x is number of cleared lines in current game, and y is number of
cleared lines in all games.

I've been using this patch for about 3 weeks without any problems...

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.29-ow1
Locale: LANG=C, LC_CTYPE=pl_PL (charmap=ISO-8859-2)

Versions of packages netris depends on:
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an
ii  libncurses5                 5.4-4        Shared libraries for terminal hand

-- no debconf information

-- 
Piotrek
irc: #debian.pl
Mors Drosophilis melanogastribus!
diff -rup netris/netris-0.52/curses.c netris-0.52.2/curses.c
--- netris/netris-0.52/curses.c 2005-03-19 15:51:30.000000000 +0100
+++ netris-0.52.2/curses.c      2005-03-20 11:06:26.000000000 +0100
@@ -263,6 +263,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);
@@ -287,7 +293,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
@@ -295,7 +301,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
diff -rup netris/netris-0.52/game.c netris-0.52.2/game.c
--- netris/netris-0.52/game.c   2005-03-19 15:51:30.000000000 +0100
+++ netris-0.52.2/game.c        2005-03-19 21:51:10.000000000 +0100
@@ -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) {
diff -rup netris/netris-0.52/netris.h netris-0.52.2/netris.h
--- netris/netris-0.52/netris.h 2005-03-19 15:51:30.000000000 +0100
+++ netris-0.52.2/netris.h      2005-03-19 21:49:02.000000000 +0100
@@ -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 */

Reply via email to