a patch for UnixPC Mahjongg

Tom Tkacik tkacik at rphroy.UUCP
Fri Oct 7 22:13:59 AEST 1988


This is the first official patch to the UnixPC version of Mahjongg,
as posted to comp.sources.games.

This patch will make the mahjongg tiles disappear from the
screen instead of redrawing all of the tiles each time any are removed.
It makes the games more pleasent to play.
Actually the tiles are redrawn onto an internal image array, and
then the final image is copied to the screen.

Tom Tkacik
{umix!mcf, uunet!edsews}!rphroy!tetnix!tet
{umix!mcf, uunet!edsews}!rphroy!megatron!tkacik
-------------------------------------------------
*** mahjongg.c.old	Sat Oct  1 18:58:57 1988
--- mahjongg.c	Sat Oct  1 18:50:32 1988
***************
*** 551,556 ****
--- 551,559 ----
  
  draw_tiles()
  {
+     /*  draw in playing_area and then copy to window */
+ 	static unsigned short playing_area[ROWS*12*COLS*9/16];
+ 
  	int i = 0;
  	wgoto(wn, 1, 23);
  	wprintf(wn, "Tiles Remaining: %3d", tile_count);
***************
*** 559,565 ****
  
       /* clear the playing field */
  
! 	wrastop(wn, 0, 0, 0, 0, 0, 0,
  		X_OFF1, Y_OFF1, 14*TILE_X+TILE_W, 7*TILE_Y+TILE_H,
  		SRCPAT, DSTSRC, patblack);
  
--- 562,568 ----
  
       /* clear the playing field */
  
! 	wrastop(wn, 0, 0, playing_area, COLS*9/8, 0, 0,
  		X_OFF1, Y_OFF1, 14*TILE_X+TILE_W, 7*TILE_Y+TILE_H,
  		SRCPAT, DSTSRC, patblack);
  
***************
*** 569,590 ****
  		if(tiles[i].removed == TRUE)
  			continue;
  		
! 		if((i >= 139) || (tiles[i].top_free == TRUE)) {
  
! 		     /* show the tile */
! 
! 			wrastop(wn, tiles[i].image, 6, 0, 0, 0, 0,
! 				tiles[i].x_pos, tiles[i].y_pos, 
! 				TILE_W, TILE_H, SRCSRC, DSTSRC, 0); 
! 		} else {
! 
! 		     /* draw a blank tile -- do not show hidden tiles */
! 			
! 			wrastop(wn, blank, 6, 0, 0, 0, 0,
! 				tiles[i].x_pos, tiles[i].y_pos, 
! 				TILE_W, TILE_H, SRCSRC, DSTSRC, 0);
! 		}
  	}
  }
  
  /*
--- 572,586 ----
  		if(tiles[i].removed == TRUE)
  			continue;
  		
! 	     /* show the tile */
  
! 		wrastop(wn, tiles[i].image, 6, playing_area, COLS*9/8, 
! 			0, 0, tiles[i].x_pos, tiles[i].y_pos, 
! 			TILE_W, TILE_H, SRCSRC, DSTSRC, 0); 
  	}
+ 	wrastop(wn, playing_area, COLS*9/8, 0, 0, X_OFF1, Y_OFF1,
+ 		X_OFF1, Y_OFF1, 14*TILE_X+TILE_W, 7*TILE_Y+TILE_H,
+ 		SRCSRC, DSTSRC, 0);
  }
  
  /*
*** event.c.old	Sat Aug 27 12:52:35 1988
--- event.c	Sun Sep 11 20:26:12 1988
***************
*** 226,239 ****
  
  	wcmd(wn, "");
  
! 	if (REMOVE) {
! 
! 	     /* turn off preview */
! 
! 		preview_tile(selected[0]);
! 		preview_tile(selected[1]);
! 
! 	} else {
  
  	     /* turn off preview of any selected tiles */
  
--- 226,232 ----
  
  	wcmd(wn, "");
  
! 	if (!REMOVE) {
  
  	     /* turn off preview of any selected tiles */
  
*** tiles.c~	Wed Oct  5 18:43:12 1988
--- tiles.c	Wed Oct  5 18:43:17 1988
***************
*** 37,46 ****
  /* the 144 tiles */
  Tile tiles[NUMTILES];
  
- unsigned short blank[96] = {
- #include "tiles/blank"
- };
- 
  /* the 42 rastor images */
  unsigned short images[42][96] = {
  	  {
--- 37,42 ----
*** mahjongg.h~	Wed Oct  5 18:12:26 1988
--- mahjongg.h	Wed Oct  5 18:12:31 1988
***************
*** 102,110 ****
  /* tile image definitions */
  extern unsigned short images[42][96];
  
- /* blank tile definition */
- extern unsigned short blank[96];
- 
  /* the 144 playing tiles */
  extern Tile tiles[NUMTILES];
  
--- 102,107 ----



More information about the Unix-pc.general mailing list