[Commit] RRClient blank.png,NONE,1.1 RRBoard.java,1.2,1.3 RRBoardPanel.java,1.2,1.3 RRClient.java,1.2,1.3 RRImages.java,1.2,1.3 robot-blue.png,1.1.1.1,1.2 robot-green.png,1.1.1.1,1.2 robot-red.png,1.1.1.1,1.2 robot-yellow.png,1.1.1.1,1.2 target-blue-circle.png,1.1.1.1,1.2 target-blue-square.png,1.1.1.1,1.2 target-blue-star.png,1.1.1.1,1.2 target-blue-triangle.png,1.1.1.1,1.2 target-green-circle.png,1.1.1.1,1.2 target-green-square.png,1.1.1.1,1.2 target-green-star.png,1.1.1.1,1.2 target-green-triangle.png,1.1.1.1,1.2 target-red-circle.png,1.1.1.1,1.2 target-red-square.png,1.1.1.1,1.2 target-red-star.png,1.1.1.1,1.2 target-red-triangle.png,1.1.1.1,1.2 target-whirlpool.png,1.1.1.1,1.2 target-yellow-circle.png,1.1.1.1,1.2 target-yellow-square.png,1.1.1.1,1.2 target-yellow-star.png,1.1.1.1,1.2 target-yellow-triangle.png,1.1.1.1,1.2target-blank.png,1.1.1.1,NONE

Bart Massey commit at keithp.com
Sat Jun 7 01:03:13 PDT 2003


Committed by: bart

Update of /local/src/CVS/RRClient
In directory home.keithp.com:/tmp/cvs-serv14159

Modified Files:
	RRBoard.java RRBoardPanel.java RRClient.java RRImages.java 
	robot-blue.png robot-green.png robot-red.png robot-yellow.png 
	target-blue-circle.png target-blue-square.png 
	target-blue-star.png target-blue-triangle.png 
	target-green-circle.png target-green-square.png 
	target-green-star.png target-green-triangle.png 
	target-red-circle.png target-red-square.png 
	target-red-star.png target-red-triangle.png 
	target-whirlpool.png target-yellow-circle.png 
	target-yellow-square.png target-yellow-star.png 
	target-yellow-triangle.png 
Added Files:
	blank.png 
Removed Files:
	target-blank.png 
Log Message:
Robot and target images use alpha channel now.  Rendering
changed accordingly.  Almost everything works.  Parsing
seems to work.



--- NEW FILE: blank.png ---
(This appears to be a binary file; contents omitted.)

Index: RRBoard.java
===================================================================
RCS file: /local/src/CVS/RRClient/RRBoard.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- RRBoard.java	7 Jun 2003 06:05:06 -0000	1.2
+++ RRBoard.java	7 Jun 2003 07:03:10 -0000	1.3
@@ -27,12 +27,6 @@
 	    squares[dim - 1][i].setWall(2);
 	    squares[i][0].setWall(3);
 	}
-	for (int i = 6; i < 10; i++) {
-	    squares[10][i].setWall(0);
-	    squares[i][5].setWall(1);
-	    squares[5][i].setWall(2);
-	    squares[i][10].setWall(3);
-	}
     }
 
     static void expect(int c, int ch)
@@ -68,8 +62,8 @@
 	    expect(c, ' ');
 	    c = s.charAt(ci++);
 	    if (c == '=') {
-		if (i - 1 > 0)
-		    squares[i-1][j].setWall(3);
+		if (i - 1 >= 0)
+		    squares[i - 1][j].setWall(2);
 		if (i < dim)
 		    squares[i][j].setWall(0);
 	    } else {
@@ -123,7 +117,7 @@
 		squares[i][j].setRobot(RRSquare.BLUE);
 		break;
 	    default:
-		expect(c, ' ');
+		expect(c, '.');
 	    }
 	    int c1 = s.charAt(ci++);
 	    int c2 = s.charAt(ci++);
@@ -156,7 +150,7 @@
 		color = RRSquare.WHIRLPOOL;
 		break;
 	    default:
-		expect(c1, ' ');
+		expect(c1, '.');
 	    }
 	    int shape = -1;
 	    switch(c2) {
@@ -188,13 +182,13 @@
 		shape = 0;
 		break;
 	    default:
-		expect(c2, ' ');
-		if (c1 != -1)
+		expect(c2, '.');
+		if (color != -1)
 		    throw new IOException("target blank mismatch");
 	    }
 	    if (color >= 0) {
-		int coord = 4 * color + shape;
-		squares[i][j].setTarget(coord, thetarget);
+		int symbol = 4 * color + shape;
+		squares[i][j].setTarget(symbol, thetarget);
 		if (thetarget) {
 		    row_goal = i;
 		    col_goal = j;
@@ -218,6 +212,13 @@
     public static RRBoard testBoard() {
 	RRBoard b = new RRBoard();
 	RRSquare s = b.squares[1][1];
+	/* XXX is this still right? */
+	for (int i = 7; i < 9; i++) {
+	    squares[9][i].setWall(0);
+	    squares[i][6].setWall(1);
+	    squares[6][i].setWall(2);
+	    squares[i][9].setWall(3);
+	}
 	s.setWall(1);
 	s.setWall(2);
 	s.setTarget(RRSquare.WHIRLPOOL * 4, true);

Index: RRBoardPanel.java
===================================================================
RCS file: /local/src/CVS/RRClient/RRBoardPanel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- RRBoardPanel.java	7 Jun 2003 06:05:06 -0000	1.2
+++ RRBoardPanel.java	7 Jun 2003 07:03:10 -0000	1.3
@@ -31,15 +31,27 @@
 	int idcol = (int)Math.floor(dcol + 1);
 	int idrow = (int)Math.floor(drow + 1);
 
+	/* draw floor */
+	Image blank_img = images.getBlankImage();
+        for (int row = 0; row < dim; row++) {
+            for (int col = 0; col < dim; col++) {
+		int xdcol = (int)Math.floor(col * dcol);
+		int ydrow = (int)Math.floor(row * drow);
+		g.drawImage(blank_img, xdcol, ydrow, idcol, idrow, this);
+	    }
+	}
         /* draw targets */
         for (int row = 0; row < dim; row++) {
             for (int col = 0; col < dim; col++) {
                 RRSquare s = board.getSquare(row, col);
-                Image img = images.getTargetImage(s.getTarget(),
-						  s.isPrimaryTarget());
+		if (s.getTarget() == RRSquare.NO_TARGET)
+		    continue;
+		if (!s.isPrimaryTarget())
+		    continue;
+		Image img = images.getTargetImage(s.getTarget(), true);
 		int xdcol = (int)Math.floor(col * dcol);
 		int ydrow = (int)Math.floor(row * drow);
-                g.drawImage(img, xdcol, ydrow, idcol, idrow, this);
+		g.drawImage(img, xdcol, ydrow, idcol, idrow, this);
             }
         }
         /* draw walls */

Index: RRClient.java
===================================================================
RCS file: /local/src/CVS/RRClient/RRClient.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- RRClient.java	7 Jun 2003 06:05:06 -0000	1.2
+++ RRClient.java	7 Jun 2003 07:03:10 -0000	1.3
@@ -12,6 +12,7 @@
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
+import java.io.*;
 
 public class RRClient extends JApplet {
 
@@ -22,8 +23,11 @@
         getContentPane().add(bp, BorderLayout.CENTER);
     }
 
-    public static void main(String[] args) {
-        RRBoard board = RRBoard.testBoard();
+    public static void main(String[] args)
+      throws IOException {
+	FileReader fin = new FileReader(args[0]);
+	BufferedReader in = new BufferedReader(fin);
+        RRBoard board = new RRBoard(in);
         RRImages images = new RRImages(Toolkit.getDefaultToolkit());
         JPanel bp = new RRBoardPanel(board, images);
         JFrame f = new JFrame("Ricochet Robots");

Index: RRImages.java
===================================================================
RCS file: /local/src/CVS/RRClient/RRImages.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- RRImages.java	7 Jun 2003 06:05:06 -0000	1.2
+++ RRImages.java	7 Jun 2003 07:03:10 -0000	1.3
@@ -39,7 +39,8 @@
     public static final int TRIANGLE = 2;
     public static final int STAR = 3;
 
-    Image[] target_images = new Image[18];
+    Image blank_image;
+    Image[] target_images = new Image[17];
     Image[] robot_images = new Image[4];
 
     GetImage imgsrc;
@@ -55,13 +56,13 @@
 
     private RRImages(GetImage imgsrc) {
         this.imgsrc = imgsrc;
-        target_images[0] = imgsrc.getImage("target-blank.png");
+        blank_image = imgsrc.getImage("blank.png");
         for (int i = 0; i < 16; i++)
-            target_images[i + 1] =
+            target_images[i] =
                 imgsrc.getImage("target-" +
                            colornames[colors[i / 4]] + "-" +
                            shapenames[i % 4] + ".png");
-        target_images[17] = imgsrc.getImage("target-whirlpool.png");
+        target_images[16] = imgsrc.getImage("target-whirlpool.png");
         for (int i = 0; i < 4; i++)
             robot_images[i] = imgsrc.getImage("robot-" +
                                          colornames[colors[i]] + ".png");
@@ -75,10 +76,12 @@
         this(new GetImage(applet));
     }
 
+    public Image getBlankImage() {
+	return blank_image;
+    }
+
     public Image getTargetImage(int index, boolean primary) {
-	if (index > 0 && !primary)
-	    return target_images[0];
-        return target_images[index + 1];
+        return target_images[index];
     }
 
     public Image getRobotImage(int index) {

Index: robot-blue.png
===================================================================
RCS file: /local/src/CVS/RRClient/robot-blue.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsVMc6Jd and /tmp/cvsmztCxj differ

Index: robot-green.png
===================================================================
RCS file: /local/src/CVS/RRClient/robot-green.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsEcmg5g and /tmp/cvsO8R5Un differ

Index: robot-red.png
===================================================================
RCS file: /local/src/CVS/RRClient/robot-red.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvslDTB2h and /tmp/cvsmtFJRp differ

Index: robot-yellow.png
===================================================================
RCS file: /local/src/CVS/RRClient/robot-yellow.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsw7rX1i and /tmp/cvsEnhHQr differ

Index: target-blue-circle.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-blue-circle.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsHxvz1j and /tmp/cvs28sPOt differ

Index: target-blue-square.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-blue-square.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsK3iP2k and /tmp/cvssFOnRv differ

Index: target-blue-star.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-blue-star.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvs9qHq5l and /tmp/cvsI2l6Vx differ

Index: target-blue-triangle.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-blue-triangle.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsAHMQ3m and /tmp/cvsEJWpeC differ

Index: target-green-circle.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-green-circle.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsLvcGrq and /tmp/cvsihX3EG differ

Index: target-green-square.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-green-square.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsK9wAqr and /tmp/cvsSgLiFI differ

Index: target-green-star.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-green-star.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsRh0Nss and /tmp/cvsgqxJGK differ

Index: target-green-triangle.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-green-triangle.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsQReart and /tmp/cvsu0fLDM differ

Index: target-red-circle.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-red-circle.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsb3bWqu and /tmp/cvs6A62FO differ

Index: target-red-square.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-red-square.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsiZ1Wuv and /tmp/cvsEF5DLQ differ

Index: target-red-star.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-red-star.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsxV0Stw and /tmp/cvs8tJS3U differ

Index: target-red-triangle.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-red-triangle.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvscx3vRz and /tmp/cvsclTsuZ differ

Index: target-whirlpool.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-whirlpool.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvst8eGVA and /tmp/cvsUiUGy1 differ

Index: target-yellow-circle.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-yellow-circle.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsQG67SB and /tmp/cvs4M4Hv3 differ

Index: target-yellow-square.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-yellow-square.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsZb5PTC and /tmp/cvswiNlz5 differ

Index: target-yellow-star.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-yellow-star.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvs2nolSD and /tmp/cvsAB54v7 differ

Index: target-yellow-triangle.png
===================================================================
RCS file: /local/src/CVS/RRClient/target-yellow-triangle.png,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
Binary files /tmp/cvsBeLTUE and /tmp/cvsoiy0A9 differ

--- target-blank.png DELETED ---




More information about the Commit mailing list