argv@island.uu.net (Dan Heller) (04/30/89)
Submitted-by: Gary E. Barnes <igor!amber!geb> Posting-number: Volume 3, Issue 90 Archive-name: dragon/part01 [ The default Makefile included here Makes a -new- makefile based on the supplied Imakefile. *great* idea -- this Makefile should be used by everyone to get the Imakefile to make a makefile for any program. My hat off to the author. On the other hand, I had to split "board.c" into three parts -- board.c.aa, board.c.ab and board.c.ac -- you need to cat them together to get board.c. Folks, let's try to keep single source files under 50K, huh? I put my hat back on. This game is fun and all that, but there are -lots- of bitmap files, so watch that disk space. Have fun. --argv ] #! /bin/sh # This is a shell archive. Remove anything before this line, then feed it # into a shell via "sh file" or similar. To overwrite existing files, # type "sh file -c". # The tool that generated this appeared in the comp.sources.unix newsgroup; # send mail to comp-sources-unix@uunet.uu.net if you want that tool. # If this archive is complete, you will see the following message at the end: # "End of archive 1 (of 10)." # Contents: README board.c.ab ic ic/mum_28x32.ic ic/rdragon_68x80.ic # tile_bits.c # Wrapped by argv@island on Sun Apr 30 00:17:47 1989 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README'\" else echo shar: Extracting \"'README'\" \(757 characters\) sed "s/^X//" >'README' <<'END_OF_FILE' X04/19/89 X XDragon is a game. It implements a version of the ancient game of Mah-Jongg. X XDragon is known to work on a Sun 3/60 running SunOS 3.5 with X11R3 from MIT. XIt compiles with the Sun compiler and with gcc version 1.31. X XAs of this writing, the Athena Dialog widget has a bug that can cause Dragon Xto get a segmentation/memory error. There is code in X11R3/lib/Xaw/Dialog.c Xin the SetValues function that looks like this: X X******** X { X Arg args[1]; X! XtSetArg( args[1], XtNlabel, w->dialog.label ); X XtSetValues( w->dialog.labelW, args, XtNumber(args) ); X } X******** Xit needs to be changed to: X******** X { X Arg args[1]; X! XtSetArg( args[0], XtNlabel, w->dialog.label ); X XtSetValues( w->dialog.labelW, args, XtNumber(args) ); X } X******** END_OF_FILE if test 757 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi # end of 'README' fi if test -f 'board.c.ab' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'board.c.ab'\" else echo shar: Extracting \"'board.c.ab'\" \(28661 characters\) sed "s/^X//" >'board.c.ab' <<'END_OF_FILE' X PNT( 0, -i ); X right = bp->level; X } X X/*--If SPEC2's upper neighbor is there then draw that tile's upper shadow. */ X X } else if (row == 3 && col == 12 && Board_Tiles[SPEC2].level > 0) { X i = Board_Tiles[SPEC2].y - bp->y; X PNT( bp->x + bp->level * Side_X + Tile_Width + 1 + 1, X bp->y - bp->level * Side_Y ); X PNT( Shadow_X, -Shadow_Y ); X PNT( 0, i + Shadow_Y ); X PNT( -Shadow_X, 0 ); X PNT( 0, -i ); X right = bp->level; X X/*--If SPEC2's lower neighbor is there then draw that tile's lower shadow. */ X X } else if (row == 4 && col == 12 && Board_Tiles[SPEC2].level > 0) { X i = bp->y - Board_Tiles[SPEC2].y; X PNT( Board_Tiles[SPEC2].x + Side_X, X Board_Tiles[SPEC2].y + Tile_Height + 1); X PNT( Shadow_X, 0 ); X PNT( 0, i - Shadow_Y); X PNT( -Shadow_X, Shadow_Y ); X PNT( 0, -i ); X right = bp->level; X } X X/*--If required, draw a normal right shadow that may be truncated by an upper X * right neighbor. */ X X if (right < bp->level) { X Polyi = 0; X if (top_right) { X i = Shadow_Y; X } else { X i = 0; X } X PNT( bp->x + bp->level * Side_X + Tile_Width + 1 + 1, X bp->y - bp->level * Side_Y ); X PNT( Shadow_X, -(Shadow_Y-i) ); X PNT( 0, Tile_Height + 1 - i ); X PNT( -Shadow_X, Shadow_Y ); X PNT( 0, -(Tile_Height + 1) ); X } X X/*--Draw any right shadow that may have been requested. */ X X if (Polyi > 0) { X XFillPolygon( XtDisplay(Board), XtWindow(Board), Over_GC, X Poly, (Cardinal)Polyi, Convex, CoordModePrevious ); X } X } X X/*--Now check for hiliting. */ X X if (Board_State != s_Sample) { X if (Click1 == bp) { X Hilite_Tile( Click1_Row, Click1_Col ); X } else if (Click2 == bp) { X Hilite_Tile( Click2_Row, Click2_Col ); X } X } X DEBUG_RETURN(Tile); X X} /* Tile */ X X Xstatic void Draw_All_Tiles() X/****************************************************************************** X* Draws all visible tiles. X******************************************************************************/ X{ X int i,j; X X/*--Draw the rightmost special tiles. */ X X DEBUG_CALL(Draw_All_Tiles); X if (Board_Tiles[SPEC1].draw && Board_Tiles[SPEC1].level > 0) { X Tile( SPEC1row, SPEC1col ); X } X if (Board_Tiles[SPEC2].draw && Board_Tiles[SPEC2].level > 0) { X Tile( SPEC2row, SPEC2col ); X } X X/*--Draw the current game. Draw the normally placed tiles. */ X X for (i = 0; i <= 7; ++i) { X for (j = 12; j >= 1; --j) { X if (Board_Tiles[i][j].draw && Board_Tiles[i][j].level > 0) { X Tile( i, j ); X } X } X } X X/*--Now draw the other special tiles. */ X X if (Board_Tiles[SPEC4].draw && Board_Tiles[SPEC4].level > 0) { X Tile( SPEC4row, SPEC4col ); X } X if (Board_Tiles[SPEC3].draw && Board_Tiles[SPEC3].level > 0) { X Tile( SPEC3row, SPEC3col ); X } X Draw_Score( Score, X (int)(Board_Tile0_X + 14 * (Tile_Width + 1)), X (int)(Board_Tile0_Y + 8 * (Tile_Height + 1)) ); X DEBUG_RETURN(Draw_All_Tiles); X X} /* Draw_All_Tiles */ X X Xstatic void Sample( face, x, y ) X int face; X int x; X int y; X/****************************************************************************** X* Draw one sample tile. X******************************************************************************/ X{ X X XDrawRectangle( XtDisplay(Board), XtWindow(Board), Normal_GC, X x, y, Tile_Width+1, Tile_Height+1 ); X (*(Faces[face]))( x+1, y+1 ); X X} /* Sample */ X X X/*ARGSUSED*/ Xstatic void Tile_Samples() X/****************************************************************************** X* Called when we want to display all tiles as a sampler. X******************************************************************************/ X{ X int x = Board_Tile0_X + 2 * Tile_Width; X int y = Board_Tile0_Y; X X/*--Clear the board. */ X X DEBUG_CALL(Tile_Samples); X X/*--Draw sample tiles. */ X X Draw_Text( "Flower", Board_Tile0_X, y ); X Draw_Text( "Flower", Board_Tile0_X+1, y ); X Sample( 5, (int)(x + (Tile_Width + 1)*0), y );/*Draw_Bamboo*/ X Sample( 6, (int)(x + (Tile_Width + 1)*1), y );/*Draw_Mum*/ X Sample( 7, (int)(x + (Tile_Width + 1)*2), y );/*Draw_Orchid*/ X Sample( 8, (int)(x + (Tile_Width + 1)*3), y );/*Draw_Plum*/ X X y += (int)Tile_Height + 1; X Draw_Text( "Season", Board_Tile0_X, y ); X Draw_Text( "Season", Board_Tile0_X+1, y ); X Sample( 1, (int)(x + (Tile_Width + 1)*0), y );/*Draw_Spring*/ X Sample( 2, (int)(x + (Tile_Width + 1)*1), y );/*Draw_Summer*/ X Sample( 3, (int)(x + (Tile_Width + 1)*2), y );/*Draw_Fall*/ X Sample( 4, (int)(x + (Tile_Width + 1)*3), y );/*Draw_Winter*/ X X y += (int)Tile_Height + 1; X Draw_Text( "Dragon", Board_Tile0_X, y ); X Draw_Text( "Dragon", Board_Tile0_X+1, y ); X Sample( 10, (int)(x + (Tile_Width + 1)*1), y );/*Draw_RDragon*/ X Sample( 11, (int)(x + (Tile_Width + 1)*2), y );/*Draw_WDragon*/ X Sample( 9, (int)(x + (Tile_Width + 1)*0), y );/*Draw_GDragon*/ X X y += (int)Tile_Height + 1; X Draw_Text( "Wind", Board_Tile0_X, y ); X Draw_Text( "Wind", Board_Tile0_X+1, y ); X Sample( 12, (int)(x + (Tile_Width + 1)*0), y );/*Draw_East*/ X Sample( 13, (int)(x + (Tile_Width + 1)*1), y );/*Draw_West*/ X Sample( 14, (int)(x + (Tile_Width + 1)*2), y );/*Draw_North*/ X Sample( 15, (int)(x + (Tile_Width + 1)*3), y );/*Draw_South*/ X X y += (int)Tile_Height + 1; X Draw_Text( "Bam", Board_Tile0_X, y ); X Draw_Text( "Bam", Board_Tile0_X+1, y ); X Sample( 16, (int)(x + (Tile_Width + 1)*0), y );/*Draw_Bam1*/ X Sample( 17, (int)(x + (Tile_Width + 1)*1), y );/*Draw_Bam2*/ X Sample( 18, (int)(x + (Tile_Width + 1)*2), y );/*Draw_Bam3*/ X Sample( 19, (int)(x + (Tile_Width + 1)*3), y );/*Draw_Bam4*/ X Sample( 20, (int)(x + (Tile_Width + 1)*4), y );/*Draw_Bam5*/ X Sample( 21, (int)(x + (Tile_Width + 1)*5), y );/*Draw_Bam6*/ X Sample( 22, (int)(x + (Tile_Width + 1)*6), y );/*Draw_Bam7*/ X Sample( 23, (int)(x + (Tile_Width + 1)*7), y );/*Draw_Bam8*/ X Sample( 24, (int)(x + (Tile_Width + 1)*8), y );/*Draw_Bam9*/ X X y += (int)Tile_Height + 1; X Draw_Text( "Dot", Board_Tile0_X, y ); X Draw_Text( "Dot", Board_Tile0_X+1, y ); X Sample( 25, (int)(x + (Tile_Width + 1)*0), y );/*Draw_Dot1*/ X Sample( 26, (int)(x + (Tile_Width + 1)*1), y );/*Draw_Dot2*/ X Sample( 27, (int)(x + (Tile_Width + 1)*2), y );/*Draw_Dot3*/ X Sample( 28, (int)(x + (Tile_Width + 1)*3), y );/*Draw_Dot4*/ X Sample( 29, (int)(x + (Tile_Width + 1)*4), y );/*Draw_Dot5*/ X Sample( 30, (int)(x + (Tile_Width + 1)*5), y );/*Draw_Dot6*/ X Sample( 31, (int)(x + (Tile_Width + 1)*6), y );/*Draw_Dot7*/ X Sample( 32, (int)(x + (Tile_Width + 1)*7), y );/*Draw_Dot8*/ X Sample( 33, (int)(x + (Tile_Width + 1)*8), y );/*Draw_Dot9*/ X X y += (int)Tile_Height + 1; X Draw_Text( "Crak", Board_Tile0_X, y ); X Draw_Text( "Crak", Board_Tile0_X+1, y ); X Sample( 34, (int)(x + (Tile_Width + 1)*0), y );/*Draw_Crak1*/ X Sample( 35, (int)(x + (Tile_Width + 1)*1), y );/*Draw_Crak2*/ X Sample( 36, (int)(x + (Tile_Width + 1)*2), y );/*Draw_Crak3*/ X Sample( 37, (int)(x + (Tile_Width + 1)*3), y );/*Draw_Crak4*/ X Sample( 38, (int)(x + (Tile_Width + 1)*4), y );/*Draw_Crak5*/ X Sample( 39, (int)(x + (Tile_Width + 1)*5), y );/*Draw_Crak6*/ X Sample( 40, (int)(x + (Tile_Width + 1)*6), y );/*Draw_Crak7*/ X Sample( 41, (int)(x + (Tile_Width + 1)*7), y );/*Draw_Crak8*/ X Sample( 42, (int)(x + (Tile_Width + 1)*8), y );/*Draw_Crak9*/ X X XFlush( XtDisplay(Board) ); X DEBUG_RETURN(Tile_Samples); X X} /* Tile_Samples */ X X X/*ARGSUSED*/ Xvoid Show_Samples( w, event, params, num_params ) X Widget w; X XEvent *event; X String *params; X Cardinal *num_params; X/****************************************************************************** X* Called when the Samples button is presses. Display or un-display the sample X* tiles. X******************************************************************************/ X{ X X XClearArea( XtDisplay(Board), XtWindow(w), X 0, Board_Tile0_Y - Side_Y - Shadow_Y, 0, 0, FALSE ); X if (Board_State == s_Normal) { X Board_State = s_Sample; X Tile_Samples(); X } else { X Board_State = s_Normal; X Board_Expose( w, event, params, num_params ); X } X X} /* Show_Samples */ X X X/*ARGSUSED*/ Xstatic void Board_Expose( w, event, params, num_params ) X Widget w; X XEvent *event; X String *params; X Cardinal *num_params; X/****************************************************************************** X* Called when the Board receives an Expose event. X******************************************************************************/ X{ X int i,j; X XEvent event2; X X/*--Getting multiple events; at least when we start. */ X X DEBUG_CALL(Board_Expose); X while (XCheckWindowEvent( XtDisplay(Board), XtWindow(Board), X ExposureMask, &event2 )) { } X X/*--Draw the correct stuff. We might not want the current game. */ X X if (Board_State == s_Sample) { X Tile_Samples(); X return; X } X X/*--Draw the entire board. */ X X for (i = 0; i < NROWS; ++i) { X for (j = 0; j < NCOLS; ++j) { X if (Board_Tiles[i][j].level > 0) { X Board_Tiles[i][j].draw = TRUE; X } X } X } X Draw_All_Tiles(); X X/*--Make sure that it all goes out to the server. */ X X XFlush( XtDisplay(Board) ); X DEBUG_RETURN(Board_Expose); X X} /* Board_Expose */ X X X/*ARGSUSED*/ Xstatic void Board_Configure( w, event, params, num_params ) X Widget w; X XConfigureEvent *event; X String *params; X Cardinal *num_params; X/****************************************************************************** X* Called when the Board receives a ConfigureNotify event. X******************************************************************************/ X{ X extern void Configure_Tiles(); X int old_height = Tile_Height; X X/*--Calculate the new Board size. */ X X DEBUG_CALL(Board_Configure); X Board_Width = event->width; X Board_Height = event->height; X Tile_Width = (Board_Width-9) / 15 - 1; X Tile_Height = (Board_Height-9) / 10 - 1; X X/*--Pick a tile size based upon the size of the board. */ X X if (Tile_Width >= 80 && Tile_Height >= 96) { X Tile_Width = 80; X Tile_Height = 96; X Configure_Tiles( 5 ); X } else if (Tile_Width >= 68 && Tile_Height >= 80) { X Tile_Width = 68; X Tile_Height = 80; X Configure_Tiles( 4 ); X } else if (Tile_Width >= 56 && Tile_Height >= 64) { X Tile_Width = 56; X Tile_Height = 64; X Configure_Tiles( 3 ); X } else if (Tile_Width >= 40 && Tile_Height >= 48) { X Tile_Width = 40; X Tile_Height = 48; X Configure_Tiles( 2 ); X } else { X Tile_Width = 28; X Tile_Height = 32; X Configure_Tiles( 1 ); X } X X/*--Figure the real 0,0 coordinate. */ X X Board_Tile0_X = 4; X Board_Tile0_Y = 4 + 2 * Tile_Height; X X/*--Figure the Shadow and Side sizes. */ X X Shadow_X = Tile_Width / 10; X Shadow_Y = Tile_Height / 10; X Side_X = (Tile_Width / 10) & ~1; X Side_Y = (Tile_Height / 10) & ~1; X X/*--See if we need to repaint. */ X X if (old_height != Tile_Height) { X Do_Button_Configuration(); X Set_Tile_Controls(); X XClearArea( XtDisplay(Board), XtWindow(Board), 0, 0, 0, 0, TRUE ); X } X DEBUG_RETURN(Board_Configure); X X} /* Board_Configure */ X X Xstatic void Set_Tile_Draw( row, col ) X int row; X int col; X/****************************************************************************** X* row - Specifies the row of the tile X* col - Specifies the column of the tile X* X* Called to set the "draw" flag on a tile. We also recursively set the X* draw flag on anyone that needs to be redrawn because we are being redrawn. X******************************************************************************/ X{ X register Board_Position bp = &Board_Tiles[row][col]; X X/*--If we don't exist or if we are already being redrawn then stop. */ X X DEBUG_CALL(Set_Tile_Draw); X if (bp->level == 0 || bp->draw) { X return; X } X X/*--Redraw us. Redraw anyone to our left that has a height greater than ours X * because their shadow/tile-face overlaps us. */ X X bp->draw = TRUE; X if (col > 0 && X Board_Tiles[row][col-1].level > bp->level) { X Set_Tile_Draw( row, col-1 ); X } X X/*--Redraw anyone below us that has a level greater than ours because their X * shadow/tile-face overlaps us. */ X X if (row < 7 && X Board_Tiles[row+1][col].level > bp->level) { X Set_Tile_Draw( row+1, col ); X } X X/*--Redraw anyone below-to-the-left of us. */ X X if (row < 7 && X col > 0 && X Board_Tiles[row+1][col-1].level > 0) { X Set_Tile_Draw( row+1, col-1 ); X } X X/*--Redraw anyone above-to-the-left of us that has a level greater than ours X * because their tile-face overlaps our tile-edge. */ X X if (row > 0 && col > 0 && X Board_Tiles[row-1][col-1].level != bp->level) { X Set_Tile_Draw( row-1, col-1 ); X } X X/*--If we are certain specific tiles then we may need to set specific other X * tiles. */ X X if (row == 3 || row == 4) { X if (col == 6 || col == 7) { X Set_Tile_Draw( SPEC4row, SPEC4col ); X } else if (col == 1) { X Set_Tile_Draw( SPEC3row, SPEC3col ); X } X } X DEBUG_RETURN(Set_Tile_Draw); X X} /* Set_Tile_Draw */ X X Xstatic void Remove_Tile( bp, row, col ) X register Board_Position bp; X int row; X int col; X/****************************************************************************** X* Called to remove the top tile of the indicated Board_Position. X******************************************************************************/ X{ X X/*--If the tile just went away then clear the area and allow the window X * background to shine through. */ X X DEBUG_CALL(Remove_Tiles); X if (bp->level == 1) { X if (Tile_Control & SHADOW) { X XClearArea( XtDisplay(Board), XtWindow(Board), X bp->x, bp->y - Side_Y - Shadow_Y, X Tile_Width + Side_X + 2 + Shadow_X, X Tile_Height + Side_Y + 2 + Shadow_Y, X FALSE ); X } else { X XClearArea( XtDisplay(Board), XtWindow(Board), X bp->x, bp->y - Side_Y, X Tile_Width + Side_X + 2, X Tile_Height + Side_Y + 2, X FALSE ); X } X } else { X int sidex = Side_X * bp->level; X int sidey = Side_Y * bp->level; X if (Tile_Control & SHADOW) { X XClearArea( XtDisplay(Board), XtWindow(Board), X bp->x + sidex, bp->y - sidey - Shadow_Y, X Tile_Width + 2 + Shadow_X, X Tile_Height+ 2 + Shadow_Y, X FALSE ); X } else { X XClearArea( XtDisplay(Board), XtWindow(Board), X bp->x + sidex, bp->y - sidey, X Tile_Width + 2, X Tile_Height+ 2, X FALSE ); X } X Set_Tile_Draw( row, col ); X } X --bp->level; X X/*--Schedule the surrounding tiles for redrawing. */ X X if (col == SPEC1col) { X if (row == SPEC4row) { X Set_Tile_Draw( 3, 6 ); X Set_Tile_Draw( 3, 7 ); X Set_Tile_Draw( 4, 6 ); X Set_Tile_Draw( 4, 7 ); X return; X } else if (row == SPEC3row) { X Set_Tile_Draw( 3, 1 ); X Set_Tile_Draw( 4, 1 ); X return; X } else if (row == SPEC2row) { X Set_Tile_Draw( SPEC1row, SPEC1col ); X Set_Tile_Draw( 3, 12 ); X Set_Tile_Draw( 4, 12 ); X return; X } else { X Set_Tile_Draw( SPEC2row, SPEC2col ); X Set_Tile_Draw( 3, 12 ); X Set_Tile_Draw( 4, 12 ); X return; X } X } X if (col == 1 && (row == 3 || row == 4)) { X Set_Tile_Draw( SPEC3row, SPEC3col ); X } X if (col == 12 && (row == 3 || row == 4)) { X Set_Tile_Draw( SPEC2row, SPEC2col ); X } X if (row > 0) { X Set_Tile_Draw( row - 1, col + 1 ); X Set_Tile_Draw( row - 1, col ); X if (col > 0 && X Board_Tiles[row-1][col].level == 0) { X Set_Tile_Draw( row - 1, col - 1 ); X } X } X Set_Tile_Draw( row, col+1 ); X if (col > 0) { X Set_Tile_Draw( row, col - 1 ); X } X if (row < 7) { X Set_Tile_Draw( row + 1, col ); X if (col > 0) { X Set_Tile_Draw( row + 1, col - 1 ); X } X } X DEBUG_RETURN(Remove_Tile); X X} /* Remove_Tile */ X X Xstatic void Touch_Tile( bp, row, col, event ) X register Board_Position bp; X register XButtonEvent *event; X/****************************************************************************** X* Called when we click on a specific tile. We decide what to do. For a X* single click we hilite the tile unless we already have two tiles hilited. X* For a "double" click with two tiles hilited we will remove both of the X* tiles. X******************************************************************************/ X{ X X/*--If there is no Click1 then this guy becomes it. */ X X DEBUG_CALL(Touch_Tile); X if (Click1 == Board_Position_NULL) { X Click1 = bp; X Click1_Row = row; X Click1_Col = col; X Hilite_Tile( row, col ); X DEBUG_RETURN(Touch_Tile); X return; X } X X/*--If there is no Click2 then this guy becomes it unless he is already Click1. X */ X X if (Click1 != bp) { X if (Click2_Row == row && X Click2_Col == col && X Click2_Time + Dragon_Resources.Double_Click_Time >= event->time) { X Click2 = bp; X } X if( Click2 == Board_Position_NULL) { X Click2 = bp; X Click2_Row = row; X Click2_Col = col; X Click2_Time = event->time; X Hilite_Tile( row, col ); X DEBUG_RETURN(Touch_Tile); X return; X } X X/*--If this guy is not one Click1 and not Click2 then we have an error. */ X X if (Click2 != bp) { X XBell( XtDisplay(Board), 0 ); X DEBUG_RETURN(Touch_Tile); X return; X } X } X X/*--If he double-clicks then remove both tiles. */ X X if (Click2_Time + Dragon_Resources.Double_Click_Time >= event->time) { X One_Button_Hint = FALSE; X Remove_Tile( Click1, Click1_Row, Click1_Col ); X Click1 = Board_Position_NULL; X Remove_Tile( Click2, Click2_Row, Click2_Col ); X Click2 = Board_Position_NULL; X Score -= 2; X Draw_All_Tiles(); X DEBUG_RETURN(Touch_Tile); X return; X } X X/*--2nd click on any tile means turn-it-off. */ X X if (Click1 == bp) { X int s; X Hilite_Tile( Click1_Row, Click1_Col ); X Click1 = Click2; X s = Click1_Row; X Click1_Row = Click2_Row; X Click2_Row = s; X s = Click1_Col; X Click1_Col = Click2_Col; X Click2_Col = s;; X Click2 = Board_Position_NULL; X } else { X Click2 = Board_Position_NULL; X Hilite_Tile( Click2_Row, Click2_Col ); X } X Click2_Time = event->time; X DEBUG_RETURN(Touch_Tile); X X} /* Touch_Tile */ X X X/*ARGSUSED*/ Xvoid Tile_Remove( w, event, params, num_params ) X Widget w; X XButtonEvent *event; X String *params; X Cardinal *num_params; X/****************************************************************************** X* Called when the remove-selected-tile-pair mouse button is pressed. X******************************************************************************/ X{ X X DEBUG_CALL(Tile_Remove); X if (Click1 != Board_Position_NULL && X Click2 != Board_Position_NULL) { X Click2_Time = event->time; X Touch_Tile( Click2, Click2_Row, Click2_Col, event ); X } X DEBUG_RETURN(Tile_Remove); X X} /* Tile_Remove */ X X Xstatic Boolean Touch( bp, event ) X register Board_Position bp; X register XButtonEvent *event; X/****************************************************************************** X* Return TRUE if this XButtonEvent touched this Board_Position. X******************************************************************************/ X{ X int face_x = bp->x + bp->level * Side_X; X int face_y = bp->y - bp->level * Side_Y; X X/*--Does this tile exist? */ X X DEBUG_CALL(Touch); X if (bp->level == 0) { X DEBUG_RETURN(Touch); X return FALSE; X } X X/*--Did we touch the face? */ X X if (event->x >= face_x && event->x <= face_x + Tile_Width + 1 && X event->y >= face_y && event->y <= face_y + Tile_Height + 1) { X DEBUG_RETURN(Touch); X return TRUE; X } X X/*--Did we touch the side? */ X X if (event->x >= bp->x && event->x <= bp->x + Tile_Width + 1 && X event->y >= bp->y && event->y <= bp->y + Tile_Height + 1) { X DEBUG_RETURN(Touch); X return TRUE; X } X X/*--Guess not. */ X X DEBUG_RETURN(Touch); X return FALSE; X X} /* Touch */ X X X/*ARGSUSED*/ Xstatic void Tile_Press( w, event, params, num_params ) X Widget w; X register XButtonEvent *event; X String *params; X Cardinal *num_params; X/****************************************************************************** X* Called when the Board receives a BtnDown event. X******************************************************************************/ X{ X register Board_Position bp; X int x; X int y; X int row; X int col; X X/*--Figure out a rough row/col coordinate for the click. */ X X DEBUG_CALL(Tile_Press); X y = event->y - Board_Tile0_Y; X if (y < 0) { return; } X row = y / (Tile_Height + 1); X if (row > 7) { return; } X x = event->x - Board_Tile0_X; X if (x < 0) { return; } X col = x / (Tile_Width + 1); X if (col < 0 || row > 14) { goto Touched; } X X/*--See if we are a special tile. */ X X if (col == 0) { X if (Touch( bp = &Board_Tiles[SPEC3], event )) { X Touch_Tile( bp, SPEC3row, SPEC3col, event ); X goto Touched; X } X goto Touched; X } else if (col == 13) { X if (Touch( bp = &Board_Tiles[SPEC2], event )) { X Touch_Tile( bp, SPEC2row, SPEC2col, event ); X goto Touched; X } X if (Touch( bp = &Board_Tiles[4][12], event )) { X Touch_Tile( bp, 4, 12, event ); X goto Touched; X } X if (Touch( bp = &Board_Tiles[3][12], event )) { X Touch_Tile( bp, 3, 12, event ); X goto Touched; X } X goto Touched; X } else if (col == SPEC1col) { X if (Touch( bp = &Board_Tiles[SPEC1], event )) { X Touch_Tile( bp, SPEC1row, SPEC1col, event ); X goto Touched; X } X if (Touch( bp = &Board_Tiles[SPEC2], event )) { X Touch_Tile( bp, SPEC2row, SPEC2col, event ); X goto Touched; X } X goto Touched; X } else if ((row == 3 || row == 4) && (col == 6 || col == 7)) { X if (Touch( bp = &Board_Tiles[SPEC4], event )) { X Touch_Tile( bp, SPEC4row, SPEC4col, event ); X goto Touched; X } X } X X/*--See if the x/y falls exactly into somebody else's tile face. */ X X if (col > 0 && row < 7) { X if (Touch( bp = &Board_Tiles[row+1][col-1], event )) { X Touch_Tile( bp, row+1, col-1, event ); X goto Touched; X } X } X if (row < 7) { X if (Touch( bp = &Board_Tiles[row+1][col], event )) { X Touch_Tile( bp, row+1, col, event ); X goto Touched; X } X } X if (col > 0) { X if (Touch( bp = &Board_Tiles[row][col-1], event )) { X Touch_Tile( bp, row, col-1, event ); X goto Touched; X } X } X X/*--We don't have a touch on a neighbor so it must be us. */ X X if (Touch( bp = &Board_Tiles[row][col], event )) { X Touch_Tile( bp, row, col, event ); X goto Touched; X } X X Touched : X DEBUG_RETURN(Tile_Press); X X} /* Tile_Press */ X X Xstatic Boolean Tile_Not_Free( row, col ) X int row; X int col; X/****************************************************************************** X* Returns TRUE if the tile has neither a left nor a right side free. X******************************************************************************/ X{ X X/*--The 4 in the center can be covered by SPEC4. */ X X if (row == 3 || row == 4) { X if ((col == 6 || col == 7) && X Board_Tiles[SPEC4].level > 0) { return TRUE; } X else if (col == 1 && X Board_Tiles[SPEC3].level > 0 && X Board_Tiles[row][col+1].level > 0) { return TRUE; } X else if (col == 12 && X Board_Tiles[SPEC2].level > 0 && X Board_Tiles[row][col-1].level > 0) { return TRUE; } X } X X/*--If a tile has a neighbor then he isn't free. */ X X if (Board_Tiles[row][col-1].level >= Board_Tiles[row][col].level && X Board_Tiles[row][col+1].level >= Board_Tiles[row][col].level) { X return TRUE; X } X X/*--Check the special tiles. */ X X if (col == SPEC1col) { X X/*--Tiles 1, 3, and 4 are always free. */ X X if (row != SPEC2row) { return FALSE; } X X/*--Tile 2 is free if tile 1 is gone or if its two normal neighbors are gone.*/ X X if (Board_Tiles[SPEC1].level > 0 && X (Board_Tiles[3][12].level > 0 || X Board_Tiles[4][12].level > 0)) { return TRUE; } X } X return FALSE; X X} /* Tile_Not_Free */ X X X/*ARGSUSED*/ Xstatic void Tile_Release( w, event, params, num_params ) X Widget w; X XEvent *event; X String *params; X Cardinal *num_params; X/****************************************************************************** X* Called when the Board receives a BtnUp event. X******************************************************************************/ X{ X extern int Cheating; X X/*--If there is a Click2 and if the tile type does not match with Click1 then X * unhilite Click2. */ X X DEBUG_CALL(Tile_Release); X if (!Cheating && X Click1 != Board_Position_NULL && X Click2 != Board_Position_NULL) { X int tile1, tile2; X X tile1 = Click1->tiles[Click1->level-1]; X tile2 = Click2->tiles[Click2->level-1]; X if (/* Do tile faces match for those types that must match exactly? */ X ((tile1 > 8 || tile2 > 8) && tile1 != tile2) || X /* Are both tiles seasons? */ X (tile1 <= 4 && tile2 > 4) || X /* Are both tiles flowers? */ X (tile1 >= 5 && tile1 <= 8 && (tile2 < 5 || tile2 > 8))) { X /* They don't match. */ X Hilite_Tile( Click2_Row, Click2_Col ); X Click2 = Board_Position_NULL; X } X } X X/*--If this tile has a left or a right neighbor then he isn't allowed. */ X X if (!Cheating) { X if (Click2 != Board_Position_NULL && X Tile_Not_Free( Click2_Row, Click2_Col)) { X Hilite_Tile( Click2_Row, Click2_Col ); X Click2 = Board_Position_NULL; X } X if (Click1 != Board_Position_NULL && X Tile_Not_Free( Click1_Row, Click1_Col)) { X Hilite_Tile( Click1_Row, Click1_Col ); X Click1 = Board_Position_NULL; X } X } X X DEBUG_RETURN(Tile_Release); X X} /* Tile_Release */ X X Xstatic void Next_Tile( Click, row, col ) X int Click; X int *row; X int *col; X/****************************************************************************** X* Returns the "next" tile past row/col that exists and is "free". Returns 0,0 X* when we run out of tiles. X******************************************************************************/ X{ X int tile1, tile2; X X/*--Loop until we give up. Advance the column. Advance the row on column X * overflow. Give up on row overflow. */ X X DEBUG_CALL(Next_Tile); X for (;;) { X ++*col; X if (*col > 14) { X *col = 1; X ++*row; X if (*row > 7) { X *row = 0; X *col = 0; X break; X } X } X X/*--Check this tile. If it doesn't exist or isn't free then ignore it. */ X X if (Board_Tiles[*row][*col].level == 0) { continue; } X if (Tile_Not_Free( *row, *col )) { continue; } X X/*--If moving Click1 then return now. */ X X if (Click == 1) { break; } X X/*--Continue the search if this tile does not match Click1. */ X X tile1 = Click1->tiles[Click1->level-1]; X tile2 = Board_Tiles[*row][*col].tiles[Board_Tiles[*row][*col].level-1]; X if (/* Do tile faces match for those types that must match exactly? */ X ((tile1 > 8 || tile2 > 8) && tile1 != tile2) || X /* Are both tiles seasons? */ X (tile1 <= 4 && tile2 > 4) || X /* Are both tiles flowers? */ X (tile1 >= 5 && tile1 <= 8 && (tile2 < 5 || tile2 > 8))) { X /* They don't match. */ X continue; X } X break; X } X DEBUG_RETURN(Next_Tile); X X} /* Next_Tile */ X X X/*ARGSUSED*/ Xvoid Hints( w, event, params, num_params ) X Widget w; X XButtonEvent *event; X String *params; X Cardinal *num_params; X/****************************************************************************** X* If Click1 not present then search for the "first" remaining tile otherwise X* use Click1 as our current "base" tile. X* If Click1 present but not Click2 then search for any match for Click1. X* If Click2 not present either then search for the first remaining tile past X* Click1 otherwise search for the first remaining tile past Click2. X* Keep searching for a new Click2 until we hit a matching tile or until we X* run out. Exit on match with new tile as Click2. X* Advance Click1 and start a new search for Click2. If we run out on Click1 X* then remove Click1. X******************************************************************************/ X{ X X/*--If we have a Click1 but no Click2 then search for a Click2. */ X X if (Click1 != Board_Position_NULL && X Click2 == Board_Position_NULL) { X One_Button_Hint = TRUE; X Click2_Row = 0; X Click2_Col = 0; X for (;;) { X Next_Tile( 2, &Click2_Row, &Click2_Col ); X if (Click2_Col == 0) { X One_Button_Hint = FALSE; X Hilite_Tile( Click1_Row, Click1_Col ); X Click1 = Board_Position_NULL; X DEBUG_RETURN(Hints); X return; X } X if (Click2_Row != Click1_Row || X Click2_Col != Click1_Col) { X Click2 = &Board_Tiles[Click2_Row][Click2_Col]; X Hilite_Tile( Click2_Row, Click2_Col ); X DEBUG_RETURN(Hints); X return; X } X } X } X X/*--Find a Click1 to work with if we don't already have one. */ X X DEBUG_CALL(Hints); X if (Click1 == Board_Position_NULL) { X Click1_Row = 0; X Click1_Col = 0; X Next_Tile( 1, &Click1_Row, &Click1_Col ); X if (Click1_Col == 0) { X DEBUG_RETURN(Hints); X return; X } X Hilite_Tile( Click1_Row, Click1_Col ); X Click1 = &Board_Tiles[Click1_Row][Click1_Col]; X } X X/*--Find our starting position for Click2 if we don't have one. */ X X if (Click2 == Board_Position_NULL) { END_OF_FILE if test 28661 -ne `wc -c <'board.c.ab'`; then echo shar: \"'board.c.ab'\" unpacked with wrong size! fi # end of 'board.c.ab' fi if test ! -d 'ic' ; then echo shar: Creating directory \"'ic'\" mkdir 'ic' fi if test -f 'ic/mum_28x32.ic' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ic/mum_28x32.ic'\" else echo shar: Extracting \"'ic/mum_28x32.ic'\" \(944 characters\) sed "s/^X//" >'ic/mum_28x32.ic' <<'END_OF_FILE' X#define mum_28x32_width 28 X#define mum_28x32_height 32 X#define mum_28x32_x_hot -1 X#define mum_28x32_y_hot -1 Xstatic char mum_28x32_bits[] = { X 0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, 0x04, 0x00, 0x40, 0x20, 0x3b, 0x00, X 0x20, 0xe0, 0x60, 0x00, 0x20, 0x40, 0x80, 0x00, 0x20, 0x40, 0x80, 0x01, X 0x20, 0x40, 0x00, 0x01, 0x40, 0x80, 0x00, 0x01, 0xe0, 0x83, 0x00, 0x01, X 0x18, 0xc6, 0x00, 0x01, 0x0c, 0xe8, 0xe1, 0x01, 0x04, 0xb8, 0x3f, 0x02, X 0x04, 0x0c, 0x02, 0x02, 0x04, 0x6c, 0x02, 0x02, 0x04, 0x4c, 0x03, 0x02, X 0x04, 0x9f, 0x01, 0x02, 0x84, 0xf1, 0x00, 0x01, 0x44, 0xc0, 0x01, 0x01, X 0x48, 0x80, 0xc2, 0x00, 0x30, 0xc0, 0x3c, 0x01, 0x20, 0x80, 0x00, 0x01, X 0x60, 0xc0, 0x00, 0x01, 0xc0, 0xe1, 0x81, 0x00, 0x00, 0x1f, 0x7f, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x80, 0x94, 0x12, 0x00, 0x80, 0x97, 0x1e, 0x00, X 0x80, 0x94, 0x12, 0x00, 0x80, 0x94, 0x12, 0x00, 0x80, 0x94, 0x12, 0x00, X 0x80, 0x64, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00}; END_OF_FILE if test 944 -ne `wc -c <'ic/mum_28x32.ic'`; then echo shar: \"'ic/mum_28x32.ic'\" unpacked with wrong size! fi # end of 'ic/mum_28x32.ic' fi if test -f 'ic/rdragon_68x80.ic' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ic/rdragon_68x80.ic'\" else echo shar: Extracting \"'ic/rdragon_68x80.ic'\" \(4663 characters\) sed "s/^X//" >'ic/rdragon_68x80.ic' <<'END_OF_FILE' X#define rdragon_68x80_width 68 X#define rdragon_68x80_height 80 X#define rdragon_68x80_x_hot -1 X#define rdragon_68x80_y_hot -1 Xstatic char rdragon_68x80_bits[] = { X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0xe0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xfc, 0xff, X 0x0f, 0x04, 0x00, 0x00, 0x00, 0x00, 0x78, 0x3f, 0x00, 0x7f, 0x02, 0x00, X 0x00, 0x00, 0x00, 0xcc, 0x07, 0x00, 0xf0, 0x13, 0x00, 0x00, 0x00, 0x00, X 0xc8, 0x03, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x03, 0x00, X 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x06, 0x00, 0x80, 0x0d, 0x00, X 0x00, 0x00, 0x00, 0x3c, 0x7c, 0x00, 0x80, 0x1f, 0x00, 0x00, 0x00, 0x00, X 0x1e, 0x98, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x28, 0x00, X 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x08, 0x00, 0x00, 0xdc, 0x01, X 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x80, X 0x0f, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, X 0x00, 0x40, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, X 0xcf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe5, 0x43, 0x02, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x00, 0xc9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, X 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, X 0xe0, 0x0f, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x20, 0x10, 0x00, X 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0xc0, X 0x03, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, X 0x20, 0x20, 0x00, 0x00, 0x00, 0x80, 0x07, 0x02, 0x00, 0x20, 0x10, 0x00, X 0x00, 0x00, 0x80, 0x07, 0x01, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, X 0x8f, 0x07, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0xdf, 0x02, 0x00, X 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x20, 0x10, 0x00, X 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, X 0xfe, 0x03, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0f, 0x00, X 0x20, 0x20, 0x00, 0x00, 0x00, 0x07, 0xf6, 0x3f, 0x00, 0x00, 0x00, 0x00, X 0x00, 0xc0, 0x00, 0xe2, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, X 0x0a, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x06, 0xfc, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0xf0, 0x03, 0x00, 0x00, 0x00, X 0x80, 0x03, 0x00, 0x05, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, X 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0f, X 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, X 0x30, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, X 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, X 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, X 0x0c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, X 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xf0, X 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, X 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, X 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, X 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, X 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, X 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, X 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, X 0x06, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, X 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x38, X 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, X 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, X 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, X 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, X 0x60, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, X 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x01, X 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x07, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, X 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0e, 0x00, X 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, X 0x00, 0xc0, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, X 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; END_OF_FILE if test 4663 -ne `wc -c <'ic/rdragon_68x80.ic'`; then echo shar: \"'ic/rdragon_68x80.ic'\" unpacked with wrong size! fi # end of 'ic/rdragon_68x80.ic' fi if test -f 'tile_bits.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'tile_bits.c'\" else echo shar: Extracting \"'tile_bits.c'\" \(16771 characters\) sed "s/^X//" >'tile_bits.c' <<'END_OF_FILE' X/****************************************************************************** X* Dragon - a version of Mah-Jongg for X Windows X* X* Author: Gary E. Barnes March 1989 X* X* tile_bits.c - Mah-Jongg tile bitmap data. X******************************************************************************/ X X#include "main.h" X X/****************************************************************************** X* Tile Sizes X* X* For each size of playing surface (there are 5 sizes) we have a different X* size for tiles and for what goes on them. The tile sizes are in the Tile X* column. X* X* Many tiles (eg. Summer) are a single image. However, some times (eg. Crak's) X* are made up of composite images. These image pieces have sizes as shown X* in the Objs column. X* X* Many tiles (eg. Summer) have writing upon them. The sizes of lettering X* on these tiles is given in the Char column. The lettering on these tiles X* is positioned upwards from the bottom of the tile by the number of pixels X* indicated in the Up column. The letters are spaced apart by the number of X* pixels indicated in the Apart column. X* X* Tile Objs Char Up Apart X* X* 28x32 7x8 4x6 1 1 X* 40x48 10x12 5x7 1 1 X* 56x64 14x16 7x11 7 1 X* 68x80 17x20 9x13 11 2 X* 80x96 20x24 9x13 16 3 X* X******************************************************************************/ X X/*--SEASONS */ X X#include "ic/spring_28x32.ic" X#include "ic/spring_40x48.ic" X#include "ic/spring_56x64.ic" X#include "ic/spring_68x80.ic" X#include "ic/spring_80x96.ic" X XXImage spring; X X#include "ic/summer_28x32.ic" X#include "ic/summer_40x48.ic" X#include "ic/summer_56x64.ic" X#include "ic/summer_68x80.ic" X#include "ic/summer_80x96.ic" X XXImage summer; X X#include "ic/fall_28x32.ic" X#include "ic/fall_40x48.ic" X#include "ic/fall_56x64.ic" X#include "ic/fall_68x80.ic" X#include "ic/fall_80x96.ic" X XXImage fall; X X#include "ic/winter_28x32.ic" X#include "ic/winter_40x48.ic" X#include "ic/winter_56x64.ic" X#include "ic/winter_68x80.ic" X#include "ic/winter_80x96.ic" X XXImage winter; X X/*--FLOWERS */ X X#include "ic/bamboo_28x32.ic" X#include "ic/bamboo_40x48.ic" X#include "ic/bamboo_56x64.ic" X#include "ic/bamboo_68x80.ic" X#include "ic/bamboo_80x96.ic" X XXImage bamboo; X X#include "ic/mum_28x32.ic" X#include "ic/mum_40x48.ic" X#include "ic/mum_56x64.ic" X#include "ic/mum_68x80.ic" X#include "ic/mum_80x96.ic" X XXImage mum; X X#include "ic/orchid_28x32.ic" X#include "ic/orchid_40x48.ic" X#include "ic/orchid_56x64.ic" X#include "ic/orchid_68x80.ic" X#include "ic/orchid_80x96.ic" X XXImage orchid; X X#include "ic/plum_28x32.ic" X#include "ic/plum_40x48.ic" X#include "ic/plum_56x64.ic" X#include "ic/plum_68x80.ic" X#include "ic/plum_80x96.ic" X XXImage plum; X X/*--DRAGONS */ X X#include "ic/gdragon_28x32.ic" X#include "ic/gdragon_40x48.ic" X#include "ic/gdragon_56x64.ic" X#include "ic/gdragon_68x80.ic" X#include "ic/gdragon_80x96.ic" X XXImage gdragon; X X#include "ic/rdragon_28x32.ic" X#include "ic/rdragon_40x48.ic" X#include "ic/rdragon_56x64.ic" X#include "ic/rdragon_68x80.ic" X#include "ic/rdragon_80x96.ic" X XXImage rdragon; X X#include "ic/wdragon_28x32.ic" X#include "ic/wdragon_40x48.ic" X#include "ic/wdragon_56x64.ic" X#include "ic/wdragon_68x80.ic" X#include "ic/wdragon_80x96.ic" X XXImage wdragon; X X/*--WINDS */ X X#include "ic/east_28x32.ic" X#include "ic/east_40x48.ic" X#include "ic/east_56x64.ic" X#include "ic/east_68x80.ic" X#include "ic/east_80x96.ic" X XXImage east; X X#include "ic/west_28x32.ic" X#include "ic/west_40x48.ic" X#include "ic/west_56x64.ic" X#include "ic/west_68x80.ic" X#include "ic/west_80x96.ic" X XXImage west; X X#include "ic/north_28x32.ic" X#include "ic/north_40x48.ic" X#include "ic/north_56x64.ic" X#include "ic/north_68x80.ic" X#include "ic/north_80x96.ic" X XXImage north; X X#include "ic/south_28x32.ic" X#include "ic/south_40x48.ic" X#include "ic/south_56x64.ic" X#include "ic/south_68x80.ic" X#include "ic/south_80x96.ic" X XXImage south; X X/*--NUMBERS */ X X#include "ic/one_10x12.ic" X#include "ic/one_14x16.ic" X#include "ic/one_17x20.ic" X#include "ic/one_20x24.ic" X#include "ic/one_7x8.ic" X XXImage one; X X#include "ic/two_10x12.ic" X#include "ic/two_14x16.ic" X#include "ic/two_17x20.ic" X#include "ic/two_20x24.ic" X#include "ic/two_7x8.ic" X XXImage two; X X#include "ic/three_10x12.ic" X#include "ic/three_14x16.ic" X#include "ic/three_17x20.ic" X#include "ic/three_20x24.ic" X#include "ic/three_7x8.ic" X XXImage three; X X#include "ic/four_10x12.ic" X#include "ic/four_14x16.ic" X#include "ic/four_17x20.ic" X#include "ic/four_20x24.ic" X#include "ic/four_7x8.ic" X XXImage four; X X#include "ic/five_10x12.ic" X#include "ic/five_14x16.ic" X#include "ic/five_17x20.ic" X#include "ic/five_20x24.ic" X#include "ic/five_7x8.ic" X XXImage five; X X#include "ic/six_10x12.ic" X#include "ic/six_14x16.ic" X#include "ic/six_17x20.ic" X#include "ic/six_20x24.ic" X#include "ic/six_7x8.ic" X XXImage six; X X#include "ic/seven_10x12.ic" X#include "ic/seven_14x16.ic" X#include "ic/seven_17x20.ic" X#include "ic/seven_20x24.ic" X#include "ic/seven_7x8.ic" X XXImage seven; X X#include "ic/eight_10x12.ic" X#include "ic/eight_14x16.ic" X#include "ic/eight_17x20.ic" X#include "ic/eight_20x24.ic" X#include "ic/eight_7x8.ic" X XXImage eight; X X#include "ic/nine_10x12.ic" X#include "ic/nine_14x16.ic" X#include "ic/nine_17x20.ic" X#include "ic/nine_20x24.ic" X#include "ic/nine_7x8.ic" X XXImage nine; X X/*--OTHER */ X X#include "ic/bam_10x12.ic" X#include "ic/bam_14x16.ic" X#include "ic/bam_17x20.ic" X#include "ic/bam_20x24.ic" X#include "ic/bam_7x8.ic" X XXImage bam; X X#include "ic/crak_28x32.ic" X#include "ic/crak_40x48.ic" X#include "ic/crak_56x64.ic" X#include "ic/crak_68x80.ic" X#include "ic/crak_80x96.ic" X XXImage crak; X X#include "ic/dot_10x12.ic" X#include "ic/dot_14x16.ic" X#include "ic/dot_17x20.ic" X#include "ic/dot_20x24.ic" X#include "ic/dot_7x8.ic" X XXImage dot; X X X/****************************************************************************** X* XImage initialization structures X******************************************************************************/ X XXImage_Init Sizes[5][28] = { X { X { &spring, spring_28x32_bits, spring_28x32_width, spring_28x32_height }, X { &summer, summer_28x32_bits, summer_28x32_width, summer_28x32_height }, X { &fall, fall_28x32_bits, fall_28x32_width, fall_28x32_height }, X { &winter, winter_28x32_bits, winter_28x32_width, winter_28x32_height }, X { &bamboo, bamboo_28x32_bits, bamboo_28x32_width, bamboo_28x32_height }, X { &mum, mum_28x32_bits, mum_28x32_width, mum_28x32_height }, X { &orchid, orchid_28x32_bits, orchid_28x32_width, orchid_28x32_height }, X { &plum, plum_28x32_bits, plum_28x32_width, plum_28x32_height }, X { &gdragon, gdragon_28x32_bits, gdragon_28x32_width, gdragon_28x32_height }, X { &rdragon, rdragon_28x32_bits, rdragon_28x32_width, rdragon_28x32_height }, X { &wdragon, wdragon_28x32_bits, wdragon_28x32_width, wdragon_28x32_height }, X { &east, east_28x32_bits, east_28x32_width, east_28x32_height }, X { &west, west_28x32_bits, west_28x32_width, west_28x32_height }, X { &north, north_28x32_bits, north_28x32_width, north_28x32_height }, X { &south, south_28x32_bits, south_28x32_width, south_28x32_height }, X { &one, one_7x8_bits, one_7x8_width, one_7x8_height }, X { &two, two_7x8_bits, two_7x8_width, two_7x8_height }, X { &three, three_7x8_bits, three_7x8_width, three_7x8_height }, X { &four, four_7x8_bits, four_7x8_width, four_7x8_height }, X { &five, five_7x8_bits, five_7x8_width, five_7x8_height }, X { &six, six_7x8_bits, six_7x8_width, six_7x8_height }, X { &seven, seven_7x8_bits, seven_7x8_width, seven_7x8_height }, X { &eight, eight_7x8_bits, eight_7x8_width, eight_7x8_height }, X { &nine, nine_7x8_bits, nine_7x8_width, nine_7x8_height }, X { &bam, bam_7x8_bits, bam_7x8_width, bam_7x8_height }, X { &crak, crak_28x32_bits, crak_28x32_width, crak_28x32_height }, X { &dot, dot_7x8_bits, dot_7x8_width, dot_7x8_height }, X { (XImage*)NULL, NULL, 0, 0 } X }, X { X { &spring, spring_40x48_bits, spring_40x48_width, spring_40x48_height }, X { &summer, summer_40x48_bits, summer_40x48_width, summer_40x48_height }, X { &fall, fall_40x48_bits, fall_40x48_width, fall_40x48_height }, X { &winter, winter_40x48_bits, winter_40x48_width, winter_40x48_height }, X { &bamboo, bamboo_40x48_bits, bamboo_40x48_width, bamboo_40x48_height }, X { &mum, mum_40x48_bits, mum_40x48_width, mum_40x48_height }, X { &orchid, orchid_40x48_bits, orchid_40x48_width, orchid_40x48_height }, X { &plum, plum_40x48_bits, plum_40x48_width, plum_40x48_height }, X { &gdragon, gdragon_40x48_bits, gdragon_40x48_width, gdragon_40x48_height }, X { &rdragon, rdragon_40x48_bits, rdragon_40x48_width, rdragon_40x48_height }, X { &wdragon, wdragon_40x48_bits, wdragon_40x48_width, wdragon_40x48_height }, X { &east, east_40x48_bits, east_40x48_width, east_40x48_height }, X { &west, west_40x48_bits, west_40x48_width, west_40x48_height }, X { &north, north_40x48_bits, north_40x48_width, north_40x48_height }, X { &south, south_40x48_bits, south_40x48_width, south_40x48_height }, X { &one, one_10x12_bits, one_10x12_width, one_10x12_height }, X { &two, two_10x12_bits, two_10x12_width, two_10x12_height }, X { &three, three_10x12_bits, three_10x12_width, three_10x12_height }, X { &four, four_10x12_bits, four_10x12_width, four_10x12_height }, X { &five, five_10x12_bits, five_10x12_width, five_10x12_height }, X { &six, six_10x12_bits, six_10x12_width, six_10x12_height }, X { &seven, seven_10x12_bits, seven_10x12_width, seven_10x12_height }, X { &eight, eight_10x12_bits, eight_10x12_width, eight_10x12_height }, X { &nine, nine_10x12_bits, nine_10x12_width, nine_10x12_height }, X { &bam, bam_10x12_bits, bam_10x12_width, bam_10x12_height }, X { &crak, crak_40x48_bits, crak_40x48_width, crak_40x48_height }, X { &dot, dot_10x12_bits, dot_10x12_width, dot_10x12_height }, X { (XImage*)NULL, NULL, 0, 0 } X }, X { X { &spring, spring_56x64_bits, spring_56x64_width, spring_56x64_height }, X { &summer, summer_56x64_bits, summer_56x64_width, summer_56x64_height }, X { &fall, fall_56x64_bits, fall_56x64_width, fall_56x64_height }, X { &winter, winter_56x64_bits, winter_56x64_width, winter_56x64_height }, X { &bamboo, bamboo_56x64_bits, bamboo_56x64_width, bamboo_56x64_height }, X { &mum, mum_56x64_bits, mum_56x64_width, mum_56x64_height }, X { &orchid, orchid_56x64_bits, orchid_56x64_width, orchid_56x64_height }, X { &plum, plum_56x64_bits, plum_56x64_width, plum_56x64_height }, X { &gdragon, gdragon_56x64_bits, gdragon_56x64_width, gdragon_56x64_height }, X { &rdragon, rdragon_56x64_bits, rdragon_56x64_width, rdragon_56x64_height }, X { &wdragon, wdragon_56x64_bits, wdragon_56x64_width, wdragon_56x64_height }, X { &east, east_56x64_bits, east_56x64_width, east_56x64_height }, X { &west, west_56x64_bits, west_56x64_width, west_56x64_height }, X { &north, north_56x64_bits, north_56x64_width, north_56x64_height }, X { &south, south_56x64_bits, south_56x64_width, south_56x64_height }, X { &one, one_14x16_bits, one_14x16_width, one_14x16_height }, X { &two, two_14x16_bits, two_14x16_width, two_14x16_height }, X { &three, three_14x16_bits, three_14x16_width, three_14x16_height }, X { &four, four_14x16_bits, four_14x16_width, four_14x16_height }, X { &five, five_14x16_bits, five_14x16_width, five_14x16_height }, X { &six, six_14x16_bits, six_14x16_width, six_14x16_height }, X { &seven, seven_14x16_bits, seven_14x16_width, seven_14x16_height }, X { &eight, eight_14x16_bits, eight_14x16_width, eight_14x16_height }, X { &nine, nine_14x16_bits, nine_14x16_width, nine_14x16_height }, X { &bam, bam_14x16_bits, bam_14x16_width, bam_14x16_height }, X { &crak, crak_56x64_bits, crak_56x64_width, crak_56x64_height }, X { &dot, dot_14x16_bits, dot_14x16_width, dot_14x16_height }, X { (XImage*)NULL, NULL, 0, 0 } X }, X { X { &spring, spring_68x80_bits, spring_68x80_width, spring_68x80_height }, X { &summer, summer_68x80_bits, summer_68x80_width, summer_68x80_height }, X { &fall, fall_68x80_bits, fall_68x80_width, fall_68x80_height }, X { &winter, winter_68x80_bits, winter_68x80_width, winter_68x80_height }, X { &bamboo, bamboo_68x80_bits, bamboo_68x80_width, bamboo_68x80_height }, X { &mum, mum_68x80_bits, mum_68x80_width, mum_68x80_height }, X { &orchid, orchid_68x80_bits, orchid_68x80_width, orchid_68x80_height }, X { &plum, plum_68x80_bits, plum_68x80_width, plum_68x80_height }, X { &gdragon, gdragon_68x80_bits, gdragon_68x80_width, gdragon_68x80_height }, X { &rdragon, rdragon_68x80_bits, rdragon_68x80_width, rdragon_68x80_height }, X { &wdragon, wdragon_68x80_bits, wdragon_68x80_width, wdragon_68x80_height }, X { &east, east_68x80_bits, east_68x80_width, east_68x80_height }, X { &west, west_68x80_bits, west_68x80_width, west_68x80_height }, X { &north, north_68x80_bits, north_68x80_width, north_68x80_height }, X { &south, south_68x80_bits, south_68x80_width, south_68x80_height }, X { &one, one_17x20_bits, one_17x20_width, one_17x20_height }, X { &two, two_17x20_bits, two_17x20_width, two_17x20_height }, X { &three, three_17x20_bits, three_17x20_width, three_17x20_height }, X { &four, four_17x20_bits, four_17x20_width, four_17x20_height }, X { &five, five_17x20_bits, five_17x20_width, five_17x20_height }, X { &six, six_17x20_bits, six_17x20_width, six_17x20_height }, X { &seven, seven_17x20_bits, seven_17x20_width, seven_17x20_height }, X { &eight, eight_17x20_bits, eight_17x20_width, eight_17x20_height }, X { &nine, nine_17x20_bits, nine_17x20_width, nine_17x20_height }, X { &bam, bam_17x20_bits, bam_17x20_width, bam_17x20_height }, X { &crak, crak_68x80_bits, crak_68x80_width, crak_68x80_height }, X { &dot, dot_17x20_bits, dot_17x20_width, dot_17x20_height }, X { (XImage*)NULL, NULL, 0, 0 } X }, X { X { &spring, spring_80x96_bits, spring_80x96_width, spring_80x96_height }, X { &summer, summer_80x96_bits, summer_80x96_width, summer_80x96_height }, X { &fall, fall_80x96_bits, fall_80x96_width, fall_80x96_height }, X { &winter, winter_80x96_bits, winter_80x96_width, winter_80x96_height }, X { &bamboo, bamboo_80x96_bits, bamboo_80x96_width, bamboo_80x96_height }, X { &mum, mum_80x96_bits, mum_80x96_width, mum_80x96_height }, X { &orchid, orchid_80x96_bits, orchid_80x96_width, orchid_80x96_height }, X { &plum, plum_80x96_bits, plum_80x96_width, plum_80x96_height }, X { &gdragon, gdragon_80x96_bits, gdragon_80x96_width, gdragon_80x96_height }, X { &rdragon, rdragon_80x96_bits, rdragon_80x96_width, rdragon_80x96_height }, X { &wdragon, wdragon_80x96_bits, wdragon_80x96_width, wdragon_80x96_height }, X { &east, east_80x96_bits, east_80x96_width, east_80x96_height }, X { &west, west_80x96_bits, west_80x96_width, west_80x96_height }, X { &north, north_80x96_bits, north_80x96_width, north_80x96_height }, X { &south, south_80x96_bits, south_80x96_width, south_80x96_height }, X { &one, one_20x24_bits, one_20x24_width, one_20x24_height }, X { &two, two_20x24_bits, two_20x24_width, two_20x24_height }, X { &three, three_20x24_bits, three_20x24_width, three_20x24_height }, X { &four, four_20x24_bits, four_20x24_width, four_20x24_height }, X { &five, five_20x24_bits, five_20x24_width, five_20x24_height }, X { &six, six_20x24_bits, six_20x24_width, six_20x24_height }, X { &seven, seven_20x24_bits, seven_20x24_width, seven_20x24_height }, X { &eight, eight_20x24_bits, eight_20x24_width, eight_20x24_height }, X { &nine, nine_20x24_bits, nine_20x24_width, nine_20x24_height }, X { &bam, bam_20x24_bits, bam_20x24_width, bam_20x24_height }, X { &crak, crak_80x96_bits, crak_80x96_width, crak_80x96_height }, X { &dot, dot_20x24_bits, dot_20x24_width, dot_20x24_height }, X { (XImage*)NULL, NULL, 0, 0 } X } X}; END_OF_FILE if test 16771 -ne `wc -c <'tile_bits.c'`; then echo shar: \"'tile_bits.c'\" unpacked with wrong size! fi # end of 'tile_bits.c' fi echo shar: End of archive 1 \(of 10\). cp /dev/null ark1isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 10 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0