argv@island.uu.net (Dan Heller) (11/22/89)
Submitted-by: Helmut Hoenig <hoenig@informatik.uni-kl.de> Posting-number: Volume 5, Issue 32 Archive-name: tron/part02 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: tron_run.c helps.c texter.c header.h messages.h # grey_maps.h # Wrapped by hoenig@incas on Thu Nov 16 14:23:25 1989 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'tron_run.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'tron_run.c'\" else echo shar: Extracting \"'tron_run.c'\" \(28406 characters\) sed "s/^X//" >'tron_run.c' <<'END_OF_FILE' X/* This program was written by Helmut Hoenig */ X/* in May of 1988 at the Unitversity of */ X/* Kaiserslautern, Germany. It may be copied freely. */ X X#define NONE 255 X#define P_TYPE unsigned char X X#define DX 128 /* Groesse des Feldes */ X#define DY 108 X#define DYSHIFT 1 X X#define times 0 X#define moremess 0 X#define datagramm 1 X Xint messflag; Xshort readshort(); X X#define CHECK(n) printf("%s: check %d%c",my_host,n,(char)10); fflush(stdout) X X#include <X11/Xlib.h> X#include <stdio.h> X#include <strings.h> X#include <sys/types.h> X#include <sys/time.h> X#include <netinet/in.h> X#include <netdb.h> X X#define XK_MISCELLANY X#define XK_LATIN1 X#include <X11/keysymdef.h> X X#include "grey_maps.h" X X#include "header.h" X#include "messages.h" X X#define MAXPLAYERS 8 X#define DIMENSION 4 X Xchar *my_host, X *mast_host; /* host of the server, received at the start */ Xint my_count; /* count to use, when sending messages to the server */ Xshort mast_port; /* port-number of the servers master_socket */ X Xint master, /* my own stream-socket */ X next; /* datagram socket to send pakets to the next player */ X Xstruct sockaddr_in mast_sin,next_sin,my_sin; Xint lastlen; X Xchar next_host[20]; /* address of the next player, received befor a game starts */ Xshort next_port; X X#if (datagramm==0) X int last_acc,last; X struct sockaddr_in last_sin; X#endif X X/* XWindowstrukturen und -Variablen */ X X#define FID 0 X#define MAPS 8 X Xextern XFontStruct *(finfo[]); Xextern Window aw; Xextern GC gc_set,gc_clear,gc_filler,gc_copy,gc_orInverted,gc_or; X XDisplay *display; XScreen *screen; Xchar *dispname; /* received by the server */ XXEvent event; XWindow backw, /* just a black background window, if the display-size doesn't fit */ X mw, /* main-window, where the action takes place X **** no eposure-events executed here (too much effort) ***/ X scorew; /* window in the middle of the screen for text-outputs */ X XXColor colors[MAPS]; XPixmap grey[MAPS]; Xlong pixels[256]; XXColor cols[DY]; Xlong planes[1]; Xint colored; X X/* Spielstrukturen und -Variablen */ X X#define x_size ((DWidth / DX)) X#define y_size ((DHeight / DY)) X#define MWWidth (DX*x_size) X#define MWHeight (DY*y_size) X Xint field[DX][DY]; X XP_TYPE xmove[DX * DY]; XP_TYPE ymove[DX * DY]; Xint lastmove,actmove; X Xtypedef struct _Pack { /* Spielpaket */ X short mode; /* mode: SETUP / PLAY */ X short game_count; /* laufende Nummer der Paketuebertragung */ X short game_number; /* Nummer des Spiels */ X short players; /* aktuelle Zahl der Spieler */ X short ready; X X P_TYPE x[MAXPLAYERS][DIMENSION]; X P_TYPE y[MAXPLAYERS][DIMENSION]; X} Pack; X X#define SETUP 1 X#define PLAY 2 X#define GAME_OVER 4 X#define AUTO_START 8 X XPack p; /* Buffer for the datagram-paket */ X Xint start_flag,players; Xint ready,wait,winner; Xint active; Xint game_num; X XP_TYPE posx,posy; Xint dx,dy; Xint fast,boost,jmp_count; X X#if (times==1) X X#define MAXMESS 100 X Xint t_count; Xstruct timeval tfield[MAXMESS+1]; Xstruct timezone zone; X X#endif X X/* Ausgabefenster */ Xstatic int lines,max_col; Xstatic char tscreen[20][80]; X X/* */ Xchar *getenv(); X Xint max_time; Xint auto_only=0; X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ Xstruct hostent *hp; Xstruct servent *sp; Xint buffer; Xint help; X Xlong timefield; X X time(&timefield); X srandom((int)timefield); X X if (argc!=6) X { fprintf(stderr,"*** you must not start this directly. ***\n"); X exit(0); X }; X X my_host=getenv("HOST"); X mast_host=argv[1]; X sscanf(argv[2],"%d",&help); X mast_port = htons((short)help); X dispname = argv[3]; X sscanf(argv[4],"%d",&my_count); X sscanf(argv[5],"%d",&messflag); X X#if (moremess==1) X printf("%s: count: %d\n",my_host,my_count); X fflush(stdout); X#endif X X/* Display oeffnen */ X if (index(dispname,'-')==NULL) X { if ((display=XOpenDisplay(dispname))==NULL) X { fprintf(stderr,"*** %s: Can't open display.\n",my_host); X auto_only=1; X } X else X { screen=XScreenOfDisplay(display,DefaultScreen(display)); X auto_only=0; X }; X } X else auto_only=1; X X/* 2 bis 3 Sockets aufmachen */ X master=streamsocket(); X X next=dgramsocket(); X X/* Socketnamen fuer eigenen Socket holen */ X X init_addr(&my_sin,my_host,htons((short)14253)); X X while (bind(next,&my_sin,sizeof my_sin)) my_sin.sin_port++; X X#if (moremess==1) X printf("%s: my port is %d.\n",my_host,(int)ntohs(my_sin.sin_port)); X fflush(stdout); X#endif X if (messflag) X { printf("%s: master: %s@%d, my-port: %s@%d\n",my_host,mast_host,(int)ntohs(mast_port),my_host,(int)ntohs(my_sin.sin_port)); X fflush(stdout); X } X/* Verbindung zum Master aufbauen */ X connect_to(master,mast_host,mast_port); X writeint(master,my_count); X writeshort(master,(short)ntohs(my_sin.sin_port)); X writeint(master,auto_only); X X game(); X X/* Sockets schliessen */ X close(master); X close(next); X} X X/***************************************************** X * Initialisation * X * + Loop, executing command-messages of the master. * X *****************************************************/ X Xgame() X{ XXSetWindowAttributes attrib; Xint i,j,t; Xint mess; X Xif(!auto_only) X{ init_texter(); X XBell(display,40); X/* XSynchronize(display,1); */ /* Hilfe fuer Testzwecke */ X X XFlush(display); X X/****************************************************** X * tries to allocate a special amount of color cells. * X * if it fails, it continues in monochrom. * X ******************************************************/ X if (XAllocColorCells(display,XDefaultColormapOfScreen(screen),False,planes,0,pixels,10+(DY>>DYSHIFT))) X { int r1,g1,b1,r2,g2,b2; X colored = True; X X XSetFillStyle(display,gc_filler,FillSolid); X X XStoreNamedColor(display,XDefaultColormapOfScreen(screen), X "red",pixels[0],DoRed | DoGreen | DoBlue); X XStoreNamedColor(display,XDefaultColormapOfScreen(screen), X "blue",pixels[1],DoRed | DoGreen | DoBlue); X XStoreNamedColor(display,XDefaultColormapOfScreen(screen), X "violet",pixels[2],DoRed | DoGreen | DoBlue); X XStoreNamedColor(display,XDefaultColormapOfScreen(screen), X "green",pixels[3],DoRed | DoGreen | DoBlue); X XStoreNamedColor(display,XDefaultColormapOfScreen(screen), X "yellow",pixels[4],DoRed | DoGreen | DoBlue); X XStoreNamedColor(display,XDefaultColormapOfScreen(screen), X "cyan",pixels[5],DoRed | DoGreen | DoBlue); X XStoreNamedColor(display,XDefaultColormapOfScreen(screen), X "navy",pixels[6],DoRed | DoGreen | DoBlue); X XStoreNamedColor(display,XDefaultColormapOfScreen(screen), X "orange",pixels[7],DoRed | DoGreen | DoBlue); X X XStoreNamedColor(display,XDefaultColormapOfScreen(screen), X "wheat",pixels[8],DoRed | DoGreen | DoBlue); X XStoreNamedColor(display,XDefaultColormapOfScreen(screen), X "dark green",pixels[9],DoRed | DoGreen | DoBlue); X XSetState(display,gc_or,pixels[9],pixels[9],GXcopy,AllPlanes); X X r1 = 192 * 256; g1 = 224 * 256; b1 = 255 * 256; X r2 = 255 * 256; g2 = 192 * 256; b2 = 192 * 256; X X for (i=0;i<(DY>>DYSHIFT);i++) X { cols[i].pixel = pixels[10+i]; X cols[i].red = (unsigned short)(r1+((r2-r1)*i)/(DY>>DYSHIFT)); X cols[i].green = (unsigned short)(g1+((g2-g1)*i)/(DY>>DYSHIFT)); X cols[i].blue = (unsigned short)(b1+((b2-b1)*i)/(DY>>DYSHIFT)); X cols[i].flags = DoRed | DoGreen | DoBlue; X } X XStoreColors(display,XDefaultColormapOfScreen(screen),cols,(DY>>DYSHIFT)); X } X else X { colored = False; } X X X grey[0]=XCreatePixmapFromBitmapData(display,ROOT,grey0_bits,grey0_width,grey0_height, X 1,0,DefaultDepthOfScreen(screen)); X grey[1]=XCreatePixmapFromBitmapData(display,ROOT,grey1_bits,grey1_width,grey1_height, X 1,0,DefaultDepthOfScreen(screen)); X grey[2]=XCreatePixmapFromBitmapData(display,ROOT,grey2_bits,grey2_width,grey2_height, X 1,0,DefaultDepthOfScreen(screen)); X grey[3]=XCreatePixmapFromBitmapData(display,ROOT,grey3_bits,grey3_width,grey3_height, X 1,0,DefaultDepthOfScreen(screen)); X grey[4]=XCreatePixmapFromBitmapData(display,ROOT,grey4_bits,grey4_width,grey4_height, X 1,0,DefaultDepthOfScreen(screen)); X grey[5]=XCreatePixmapFromBitmapData(display,ROOT,grey5_bits,grey5_width,grey5_height, X 1,0,DefaultDepthOfScreen(screen)); X grey[6]=XCreatePixmapFromBitmapData(display,ROOT,grey6_bits,grey6_width,grey6_height, X 1,0,DefaultDepthOfScreen(screen)); X grey[7]=XCreatePixmapFromBitmapData(display,ROOT,grey7_bits,grey7_width,grey7_height, X 1,0,DefaultDepthOfScreen(screen)); X X backw=XCreateSimpleWindow(display,ROOT,0,0,DWidth,DHeight, X 0,WhitePixelOfScreen(screen),BlackPixelOfScreen(screen)); X attrib.override_redirect = 1; X XChangeWindowAttributes(display,backw,CWOverrideRedirect,&attrib); X X if (colored) X { mw=XCreateSimpleWindow(display,backw, X (DWidth-MWWidth)>>1,(DHeight-MWHeight)>>1,MWWidth,MWHeight, X 0,WhitePixelOfScreen(screen),cols[DY>>(DYSHIFT+1)].pixel); X } X else X { mw=XCreateSimpleWindow(display,backw, X (DWidth-MWWidth)>>1,(DHeight-MWHeight)>>1,MWWidth,MWHeight, X 0,WhitePixelOfScreen(screen),BlackPixelOfScreen(screen)); X } X X XSelectInput(display,mw,ExposureMask | ButtonPressMask | KeyPressMask | KeyReleaseMask ); X attrib.override_redirect = 1; X XChangeWindowAttributes(display,mw,CWOverrideRedirect,&attrib); X XMapRaised(display,mw); X X if (colored) X { scorew=XCreateSimpleWindow(display,ROOT,0,0,DWidth,DHeight,8,pixels[9],cols[DY>>(DYSHIFT+1)].pixel); X } X else X { scorew=XCreateSimpleWindow(display,ROOT,0,0,DWidth,DHeight,8,BlackPixelOfScreen(screen),WhitePixelOfScreen(screen)); X XSetWindowBorderPixmap(display,scorew,grey[5]); X } X XSelectInput(display,scorew,ExposureMask); X XChangeWindowAttributes(display,scorew,CWOverrideRedirect,&attrib); X} X X/************* X * MAIN-LOOP * X *************/ X for(;;) X switch(mess=readint(master)) X { int len,signs; X X case GAMESTART: X/* weitere Informationen zum aktuellen Spiel holen */ X players=readint(master); /* Anzahl der Spieler */ X active=readint(master); /* Flag, ob eigener Spieler rechnergesteuert */ X game_num=readint(master); /* Spielezaehler */ X X start_flag=readint(master); /* Flag, ob man fuer das erste Datagramm im Ring sorgen soll */ X X/* Socket-Adresse des naechsten Spielers im Ring empfangen */ X readstring(master,next_host,19); X next_port=htons(readshort(master)); X init_addr(&next_sin,next_host,next_port); X if (messflag) X { printf("%s: start of game %d with %d players (start_flag=%d)\n",my_host,game_num,players,start_flag); X printf("%s: next port is %s@%d\n",my_host,next_host,(int)ntohs(next_port)); X fflush(stdout); X } X prepare_to_start(); X X#if (moremess==1) X printf("%s: received players: %d active: %d start: %d.\n",my_host,players,active,start_flag); X fflush(stdout); X#endif X X/* ausgewaehlter Spieler initialisiert Packet-Struktur und sendet sie in den Ring */ X p.mode=(short)SETUP; X if (start_flag) X { p.game_count=(short)0; X p.players=(short)players; X p.ready=(short)0; X p.game_number=(short)game_num; X for (i=0;i<MAXPLAYERS;i++) X for (j=0;j<DIMENSION;j++) X { p.x[i][j]=posx= (P_TYPE)NONE; X p.y[i][j]=posy= (P_TYPE)NONE; X }; X write_p(); X } X X/* Schleife fuer Ausfuehrung eines Zuges */ X#if (times==0) X while(make_move()); X#else X /************************************************************************* X * Testprogramm zur Messung der Umlaufzeit des Datagramms durch den Ring * X *************************************************************************/ X X for (t_count=0;t_count<=MAXMESS;t_count++) X { gettimeofday(&tfield[t_count],&zone); X while (read_p()); X write_p(); X }; X if (start_flag) X { FILE *fopen(),*fp; X fp=fopen("sockets/time_file","w"); X for (t_count=1;t_count<=MAXMESS;t_count++) X { long t; X X t=((tfield[t_count].tv_sec & 0xffff)*1000000 + tfield[t_count].tv_usec) X -((tfield[t_count-1].tv_sec & 0xffff)*1000000 + tfield[t_count-1].tv_usec); X fprintf(fp,"%3d: %8ld usec\n",t_count,t); X }; X fclose(fp); X printf("%s: Timefile written.\n",my_host); X fflush(stdout); X }; X#endif X if (!auto_only) XUngrabServer(display); X break; X case SCORE: X read_scores(); /* Stringfeld lesen und ausgeben */ X if (!auto_only) redraw_scores(); X break; X case EXIT: X printf("%s: program ends.\n",my_host); /* Programm beenden */ X exit(0); X break; X case UNMAP: X if (auto_only) break; X XUnmapWindow(display,scorew); /* Punktefenster vom Bildschirm entfernen */ X XUnmapWindow(display,backw); X XFlush(display); X break; X default: X fprintf(stderr,"%s: received unknown instruction (%d) from master.\n",my_host,mess); X break; X }; X} X X/******************** X * Stringfeld lesen * X ********************/ X Xread_scores() X{ int l; X X max_col=0; X lines=readint(master); X X for (l=0;l<lines;l++) X { readstring(master,&tscreen[l][0],80); X if (strlen(tscreen[l])>max_col) X max_col=strlen(tscreen[l]); X }; X} X X/*********************** X * Stringfeld ausgeben * X ***********************/ X Xredraw_scores() X{ int x_wsize,y_wsize; X int l; X XEvent event; X X if (auto_only) return; X X XUnmapWindow(display,scorew); X x_wsize=CharWidth(FID) * (2+max_col); X y_wsize=CharHeight(FID) * (2+lines); X XMoveResizeWindow(display,scorew,(DWidth-x_wsize)>>1,(DHeight-y_wsize)>>1,x_wsize,y_wsize); X XMapRaised(display,scorew); X/* XWindowEvent(display,scorew,ExposureMask,&event); */ X if (colored) X { int xw=1,i; X int sdx=(x_wsize>>5); X int y0,y1; X X y0=0; X for (i=0;i<32;i++) X { y1 = y_wsize*(i+1)/32; X XSetForeground(display,gc_filler,cols[(DY>>DYSHIFT)*(31-i)/32].pixel); X XFillRectangle(display,scorew,gc_filler,0,y0,xw*sdx,y1-y0); X y0=y1; X } X do X { XCopyArea(display,scorew,scorew,gc_filler, X 0,0,xw*sdx,y_wsize,xw*sdx,0); X xw<<=1; X } X while (xw<=32); X } X else X { XClearWindow(display,scorew); X } X aw=scorew; X X for (l=0;l<lines;l++) X { printat(1,l+1,tscreen[l],FID); X }; X XFlush(display); X} X X/********************** X * Spielfeld loeschen * X **********************/ X Xempty_all() X{ int x,y; X X for (x=0;x<DX;x++) X for (y=0;y<DY;y++) X field[x][y]=0; X for (x=0;x<DX;x++) X { field[x][0]= -1; X field[x][DY-1]= -1; X }; X for (y=0;y<DY;y++) X { field[0][y]= -1; X field[DX-1][y]= -1; X }; X} X X/***************************************** X * Vorbereitungen zum Spielstart treffen * X *****************************************/ X Xprepare_to_start() X{ int i; X XEvent event; X X empty_all(); X if (active==1) X { XGrabServer(display); X XMapRaised(display,backw); X/* XWindowEvent(display,mw,ExposureMask,&event); */ X XClearWindow(display,mw); X X if (colored) X { int xw = 1; X X for (i=0;i<(DY>>DYSHIFT);i++) X { XSetForeground(display,gc_filler,cols[i].pixel); X XFillRectangle(display,mw,gc_filler,0,y_size+i*(y_size<<DYSHIFT),xw*x_size,(y_size<<DYSHIFT)); X } X do X { XCopyArea(display,mw,mw,gc_filler, X 0,0,xw*x_size,MWHeight,xw*x_size,0); X xw<<=1; X } X while (xw<DX); X X XSetForeground(display,gc_filler,pixels[9]); X XFillRectangle(display,mw,gc_filler,0,0,MWWidth,y_size-1); X XFillRectangle(display,mw,gc_filler,0,MWHeight-y_size,MWWidth,y_size); X XFillRectangle(display,mw,gc_filler,0,0,x_size-1,MWHeight); X XFillRectangle(display,mw,gc_filler,MWWidth-x_size,0,x_size,MWHeight); X } X else X { XFillRectangle(display,mw,gc_clear,0,0,MWWidth-1,y_size-1); X XFillRectangle(display,mw,gc_clear,0,MWHeight-y_size,MWWidth-1,y_size-1); X XFillRectangle(display,mw,gc_clear,0,0,x_size-1,MWHeight-1); X XFillRectangle(display,mw,gc_clear,MWWidth-x_size,0,x_size-1,MWHeight-1); X } X XFlush(display); X }; X X writeint(master,PLAYER_READY); X dx = 0; X dy = 0; X fast = 0; X boost = 0; X ready = 0; X wait = 0; X winner = 0; X X jmp_count = 10; X X lastmove=0; X actmove=0; X X X if (!auto_only) X { XSync(display,1); X while(XPending(display)) XNextEvent(display,&event); X } X X} X X/*** Datagramm schreiben ***/ X Xwrite_p() X{ X p.mode = htons(p.mode); X p.game_count = htons(p.game_count); X p.game_number = htons(p.game_number); X p.players = htons(p.players); X p.ready = htons(p.ready); X sendto(next,&p,sizeof (Pack),0,&next_sin,sizeof next_sin); X p.mode = ntohs(p.mode); X p.game_count = ntohs(p.game_count); X p.game_number = ntohs(p.game_number); X p.players = ntohs(p.players); X p.ready = ntohs(p.ready); X} X X/*** Datagramm lesen (Fehler bei Wartezeit>5 Sekunden) ***/ X Xread_p() X{ X int nfound,readfds,writefds,execptfds; Xstruct timeval timeout; X int fromlen=0; X X readfds=(1<<next); X writefds=execptfds=0; X /* bei angefangenem Spiel Timeout nach 5 Sekunden */ X timeout.tv_sec=(p.mode!=(short)PLAY)?(long)60:(long)5; X timeout.tv_usec=(long)0; X X nfound=select(32,&readfds,&writefds,&execptfds,&timeout); X X if (nfound<=0) return(1); X else X { recvfrom(next,&p,sizeof (Pack),0,NULL,&fromlen); X p.mode = ntohs(p.mode); X p.game_count = ntohs(p.game_count); X p.game_number = ntohs(p.game_number); X p.players = ntohs(p.players); X p.ready = ntohs(p.ready); X return(0); X }; X} X X/***************************************** X * einen kompletten Spielzug ausfuehren: * X * - Datagramm empfangen * X * - Spielfeld aktualisieren * X * - Eingabeevents auswerten * X * - eigenen Zug ausfuehren * X * - Datagramm senden * X * - Bildschirm aktualisieren * X *****************************************/ X Xmake_move() X{ Xint i,j; Xint root_x,root_y,mx,my; XWindow root,child; Xint mask; X X/* Packet holen */ X do X { X if (read_p()) X { missing_datagram(); X return(0); X }; X } X while (game_num != (int)p.game_number); X X p.game_count++; X X if (p.mode & (short)GAME_OVER) X { if (!(winner)) write_p(); /* Alle ausser dem Sieger leiten das Packet noch einmal weiter */ X return(0); X }; X X if (p.mode & (short)(SETUP | AUTO_START)) X { if ((p.players==(short)0) && (active==1)) X { XBell(display,0); X XFlush(display); X }; X X if (start_flag) X { if (p.game_count>(short)400) p.mode=(short)AUTO_START; X }; X X if (wait) X { sleep(2); X wait=0; X p.mode=(short)PLAY; X p.players=(short)players; X }; X X }; X X if (active==0) X { write_p(); X return(1); X }; X X/* Zug ausfuehren */ X X/* a.) neue Positionen ins Spielfeld eintragen */ X for (i=0;i<MAXPLAYERS;i++) X if (p.ready & (short)(1<<i)) X { if (p.x[i][0]!=(P_TYPE)NONE) X { field[p.x[i][0]][p.y[i][0]]=i+1; X if (p.x[i][1]!=(P_TYPE)NONE) X { field[p.x[i][1]][p.y[i][1]]=i+1; X if (p.x[i][2]!=(P_TYPE)NONE) X { field[p.x[i][2]][p.y[i][2]]=i+1; X if (p.x[i][3]!=(P_TYPE)NONE) X field[p.x[i][3]][p.y[i][3]]=i+1; X }; X }; X }; X } X else X { if (p.x[i][0]!=(P_TYPE)NONE) X { field[p.x[i][0]][p.y[i][0]]=0; X if (p.x[i][1]!=(P_TYPE)NONE) X { field[p.x[i][1]][p.y[i][1]]=0; X if (p.x[i][2]!=(P_TYPE)NONE) X { field[p.x[i][2]][p.y[i][2]]=0; X if (p.x[i][3]!=(P_TYPE)NONE) X field[p.x[i][3]][p.y[i][3]]=0; X }; X }; X }; X }; X X/* Computerspiel ? */ X if (active==2) X { comp_move(); X write_p(); X return(1); X }; X X/* b.) MausEvent auswerten */ X if (XPending(display)!=0) execute_event(); X X/* Spieler automatisch setzen, wenn er es nicht selbst tut. */ X if ((p.mode & (short)AUTO_START) && (ready==0)) X { XQueryPointer(display,mw,&root,&child,&root_x,&root_y,&mx,&my,&mask); X setplayer((P_TYPE)(mx / x_size),(P_TYPE)(my / y_size),1); X }; X X/* c.) eigenen Zug ausfuehren */ X if (p.mode & (short)PLAY) X { if (ready) X { move(0); X X/* bei gedrueckter mittlerer Taste schnellere Fahrt */ X if (fast) X { if (XPending(display)!=0) execute_event(); X move(1); X X if (boost) X { if (XPending(display)!=0) execute_event(); X move(2); X if (XPending(display)!=0) execute_event(); X move(3); X } X else X { p.x[my_count][2]= (P_TYPE)NONE; X p.y[my_count][2]= (P_TYPE)NONE; X p.x[my_count][3]= (P_TYPE)NONE; X p.y[my_count][3]= (P_TYPE)NONE; X }; X } X else X { p.x[my_count][1]= (P_TYPE)NONE; X p.y[my_count][1]= (P_TYPE)NONE; X }; X } X else if (actmove!=lastmove) deleter(); X else p.x[my_count][0]=(P_TYPE)NONE; X X X }; X X/* Packet senden */ X write_p(); X X/* Bildschirm bearbeiten */ X for (i=0;i<MAXPLAYERS;i++) X if (p.ready & (short)(1<<i)) X { if (p.x[i][0]!=(P_TYPE)NONE) X { if (colored) XSetForeground(display,gc_filler,pixels[i]); X else XSetTile(display,gc_filler,grey[i]); X XFillRectangle(display,mw,gc_filler,p.x[i][0]*x_size,p.y[i][0]*y_size,x_size-1,y_size-1); X if (p.x[i][1]!=(P_TYPE)NONE) X { XFillRectangle(display,mw,gc_filler,p.x[i][1]*x_size,p.y[i][1]*y_size,x_size-1,y_size-1); X if (p.x[i][2]!=(P_TYPE)NONE) X { XFillRectangle(display,mw,gc_filler,p.x[i][2]*x_size,p.y[i][2]*y_size,x_size-1,y_size-1); X if (p.x[i][3]!=(P_TYPE)NONE) X { XFillRectangle(display,mw,gc_filler,p.x[i][3]*x_size,p.y[i][3]*y_size,x_size-1,y_size-1); X }; X }; X }; X }; X } X else X { if (colored) X { if (p.x[i][0]!=(P_TYPE)NONE) X { XSetForeground(display,gc_filler,cols[p.y[i][0]>>DYSHIFT].pixel); X XFillRectangle(display,mw,gc_filler,p.x[i][0]*x_size,p.y[i][0]*y_size,x_size-1,y_size-1); X if (p.x[i][1]!=(P_TYPE)NONE) X { XSetForeground(display,gc_filler,cols[p.y[i][1]>>DYSHIFT].pixel); X XFillRectangle(display,mw,gc_filler,p.x[i][1]*x_size,p.y[i][1]*y_size,x_size-1,y_size-1); X if (p.x[i][2]!=(P_TYPE)NONE) X { XSetForeground(display,gc_filler,cols[p.y[i][2]>>DYSHIFT].pixel); X XFillRectangle(display,mw,gc_filler,p.x[i][2]*x_size,p.y[i][2]*y_size,x_size-1,y_size-1); X if (p.x[i][3]!=(P_TYPE)NONE) X { XSetForeground(display,gc_filler,cols[p.y[i][3]>>DYSHIFT].pixel); X XFillRectangle(display,mw,gc_filler,p.x[i][3]*x_size,p.y[i][3]*y_size,x_size-1,y_size-1); X } X }; X }; X } X } X else X { if (p.x[i][0]!=(P_TYPE)NONE) X { XFillRectangle(display,mw,gc_set,p.x[i][0]*x_size,p.y[i][0]*y_size,x_size-1,y_size-1); X if (p.x[i][1]!=(P_TYPE)NONE) X { XFillRectangle(display,mw,gc_set,p.x[i][1]*x_size,p.y[i][1]*y_size,x_size-1,y_size-1); X if (p.x[i][2]!=(P_TYPE)NONE) X { XFillRectangle(display,mw,gc_set,p.x[i][2]*x_size,p.y[i][2]*y_size,x_size-1,y_size-1); X if (p.x[i][3]!=(P_TYPE)NONE) X XFillRectangle(display,mw,gc_set,p.x[i][3]*x_size,p.y[i][3]*y_size,x_size-1,y_size-1); X }; X }; X } X } X }; X X XSync(display,0); X return(1); X} X X/******************************************************************** X * Automatisches Setzen des Spielers, wenn Wartezeit ueberschritten * X ********************************************************************/ X Xsetplayer(mx,my,again) X P_TYPE mx,my; X int again; X{ X do X { if ((mx>0) && (mx<DX-1) && (my>0) && (my<DY-1) && (field[mx][my]==0)) X { xmove[lastmove ]= posx = p.x[my_count][0] = mx; X ymove[lastmove++]= posy = p.y[my_count][0] = my; X field[mx][my]=my_count+1; X if ((--p.players) == 0) wait=1; X else wait=0; X ready = 1; X p.ready |= (short)(1<<my_count); X again = 0; X }; X if (again) X { if ((mx<(DX>>1)) || (again>10)) mx++; X else mx--; X if (my<(DY>>1)) my++; X else my--; X again++; X }; X } X while(again); X} X X/******************** X * Event bearbeiten * X ********************/ X Xexecute_event() X{ int help; X XXEvent event; X X int fct=0; X Xdo X{ X XNextEvent(display,&event); X X switch (event.type) X { X case ButtonPress: X switch((int)event.xbutton.button) X { X case Button3: X if (!(boost)) fct=2; X break; X case Button2: X if ((ready == 0) && (p.mode & (short)SETUP)) X { P_TYPE mx,my; X setplayer((P_TYPE)(event.xbutton.x / x_size),(P_TYPE)(event.xbutton.y / y_size),0); X } X else X fct=3; X break; X case Button1: X if (!(boost)) fct=1; X break; X }; /* end switch(button) */ X break; /* end ButtonPress */ X X case KeyPress: X { char sign; X KeySym keysym; X Xstatic Time last_time; X X XLookupString(&event,&sign,1,&keysym,NULL); X X if ((event.xkey.time==last_time) || (event.xkey.time==last_time + 1)) break; X X switch(keysym) X { X/*** KEYS to turn left ***/ X case XK_Z: X case XK_z: X case XK_X: X case XK_x: X case XK_M: X case XK_m: X case XK_less: X case XK_comma: X fct=1; X last_time=event.xkey.time; X break; X X/*** KEYS to turn right ***/ X case XK_C: X case XK_c: X case XK_V: X case XK_v: X case XK_greater: X case XK_period: X case XK_question: X case XK_slash: X fct=2; X last_time=event.xkey.time; X break; X X/*** jump ***/ X case XK_space: X fct=3; X break; X/*** double speed ***/ X case XK_Shift_L: X fast=1; boost=0; break; X break; X X/*** double double speed ***/ X case XK_Control_L: X fast=boost=((event.xkey.state & ShiftMask)?1:0); X break; X }; X }; X break; X X case KeyRelease: X { char sign; X KeySym keysym; X X XLookupString(&event,&sign,1,&keysym,NULL); X switch(keysym) X { X case XK_Shift_L: fast=0; boost=0; break; X case XK_Control_L: fast=((event.xkey.state & ShiftMask)?1:0); boost=0; break; X }; X }; X }; X} Xwhile ((XPending(display)) && (event.type==KeyRelease)); X X switch(fct) X { X case 1: X help= dx ; X dx = dy ; X dy = -help; X break; X case 2: X help=dy ; X dy =dx ; X dx = -help; X break; X case 3: X if (jmp_count == 0) X { XBell(display,80); X } X else X { X posx += (P_TYPE)(3*dx) ; X posy += (P_TYPE)(3*dy) ; X jmp_count--; X } X break; X }; /* end switch(fct) */ X} X X/******************************** X * bust - Spieler ist zerstoert * X ********************************/ X Xbust() X{ if (active==1) X { XBell(display,40); X XFlush(display); X }; X ready = 0; X p.ready &= (short)~(1<<my_count); X p.x[my_count][0]= (P_TYPE)NONE; X X if (--p.players==0) X { p.mode=(short)GAME_OVER; /* falls letzter Spieler => Spiel ist aus */ X winner=1; X }; X writeint(master,DESTROYED); X writeint(master,(int)p.game_count); X} X Xmissing_datagram() X{ X writeint(master,ERROR); X} X X/********************************************************************************* X * Zug ausfuehren (ind = Index bei gleichzeitigen Zuegen (maxmal 4 bei boost=1)) * X *********************************************************************************/ X Xmove(ind) X int ind; X{ int root_x,root_y,mx,my; X Window root,child; X int mask; X X if ((dx == 0) && (dy == 0)) X { XQueryPointer(display,mw,&root,&child,&root_x,&root_y,&mx,&my,&mask); X mx= (mx/x_size-posx ); X my= -(my/y_size-posy ); X if (mx>my) X { if (mx> -my) X { dx =1; dy =0; } X else X { dx =0; dy =1; } X } X else X { if (mx> -my) X { dx =0; dy = -1; } X else X { dx = -1; dy =0; }; X }; X fast = (mask & ShiftMask)?1:0; X boost = ((mask & ControlMask)&&(fast))?1:0; X }; X posx += (P_TYPE)dx ; X posy += (P_TYPE)dy ; X X if ((posx!=(P_TYPE)0) && (posy!=(P_TYPE)0) && (posx<(P_TYPE)DX-1) && (posy<(P_TYPE)DY-1) && (field[posx][posy]==0) && ((p.players>(short)1) || (players==1))) X { field[posx][posy]=my_count+1; X xmove[lastmove] =p.x[my_count][ind]=posx; X ymove[lastmove++]=p.y[my_count][ind]=posy; X } X else if (ind==0) bust(); X else X { posx -= (P_TYPE)dx ; X posy -= (P_TYPE)dy ; X }; X} X X/************************************ X * zu loeschende Felder vorbereiten * X ************************************/ X Xdeleter() X{ int i; X X for (i=0;i<DIMENSION;i++) X { if (actmove<lastmove) X { p.x[my_count][i]=xmove[actmove]; X p.y[my_count][i]=ymove[actmove++]; X } X else X { p.x[my_count][i]=(P_TYPE)NONE; X p.y[my_count][i]=(P_TYPE)NONE; X }; X } X} X X/*************************** X * Computerzug-Algorithmus * X ***************************/ X Xchangedir() X{ int dir[4],dir2[4],r1,r2,ok; X X dir2[0]=(dir[0]=(field[posx+1][posy ]==0)) & (field[posx+2][posy ]==0); X dir2[1]=(dir[1]=(field[posx ][posy+1]==0)) & (field[posx ][posy+2]==0); X dir2[2]=(dir[2]=(field[posx-1][posy ]==0)) & (field[posx-2][posy ]==0); X dir2[3]=(dir[3]=(field[posx ][posy-1]==0)) & (field[posx ][posy-2]==0); X X r1=r2=(random() & 3); X ok=0; X do X { if (dir2[r1]) X { ok=1; X break; X }; X } X while ((r1= ((r1+1)&3))!=r2); X X if (ok==0) X do X { if (dir[r1]) break; X } X while ((r1= ((r1+1)&3))!=r2); X X switch(r1) X { X case 0: dx= 1; dy= 0; break; X case 1: dx= 0; dy= 1; break; X case 2: dx= -1; dy= 0; break; X case 3: X default: dx= 0; dy= -1; break; X }; X X posx+=(P_TYPE)dx; X posy+=(P_TYPE)dy; X} X Xcomp_move() X{ X if (p.mode==(short)PLAY) X { if (ready) X { X if ((dx==0) && (dy==0)) X { switch(random() & 3) X { X case 0: dx= 1; dy= 0; break; X case 1: dx= 0; dy= 1; break; X case 2: dx= -1; dy= 0; break; X case 3: X default: dx= 0; dy= -1; break; X }; X }; X if ((random()%30)>0) X { int helpx,helpy; X X if (field[helpx=((int)posx+dx)][helpy=((int)posy+dy)]==0) X { if (field[helpx+dx][helpy+dy]==0) X { posx=(P_TYPE)helpx; X posy=(P_TYPE)helpy; X } X else X changedir(); X } X else X changedir(); X } X else X changedir(); X X if ((field[posx][posy]==0) && ((p.players>(short)1) || (players==1))) X { field[posx][posy]=my_count+1; X xmove[lastmove] =p.x[my_count][0]=posx; X ymove[lastmove++]=p.y[my_count][0]=posy; X } X else bust(); X } X else if (actmove!=lastmove) deleter(); X else p.x[my_count][0]=(P_TYPE)NONE; X } X else if ((p.mode==(short)SETUP) && (ready==0)) X { X setplayer(1+(random()%(DX-2)),1+(random()%(DY-2)),1); X }; X} END_OF_FILE if test 28406 -ne `wc -c <'tron_run.c'`; then echo shar: \"'tron_run.c'\" unpacked with wrong size! fi # end of 'tron_run.c' fi if test -f 'helps.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'helps.c'\" else echo shar: Extracting \"'helps.c'\" \(2729 characters\) sed "s/^X//" >'helps.c' <<'END_OF_FILE' X/* This program was written by Helmut Hoenig */ X/* in May of 1988 at the Unitversity of */ X/* Kaiserslautern, Germany. It may be copied freely. */ X X#include <stdio.h> X#include <sys/types.h> X#include <sys/socket.h> X#include <netinet/in.h> X#include <netdb.h> X Xchar *getenv(); X Xint streamsocket() X{ int s; X X if ((s=socket(AF_INET,SOCK_STREAM,0))<0) X { fprintf(stderr,"*** %s: Can't create socket.\n",getenv("HOST")); X exit(0); X }; X return(s); X} X Xint dgramsocket() X{ int s; X X if ((s=socket(AF_INET,SOCK_DGRAM,0))<0) X { fprintf(stderr,"*** %s: Can't create socket.\n",getenv("HOST")); X exit(0); X }; X return(s); X} X Xint readint(socket) X int socket; X{ int buffer,signs; X int s; X X signs=0; X while(signs<sizeof buffer) X { if ((s=read(socket,((char *)&buffer)+signs,(sizeof buffer)-signs))==0) X { printf("** %s: BROKEN PIPE\n",getenv("HOST")); X fflush(stdin); X exit(0); X }; X signs+=s; X }; X X buffer=ntohl(buffer); X return(buffer); X} X Xwriteint(socket,number) X int socket,number; X{ int buffer; X X buffer=htonl(number); X write(socket,&buffer,sizeof buffer); X} Xshort readshort(socket) X int socket; X{ short buffer; X int signs; X int s; X X signs=0; X while(signs<sizeof buffer) X { if ((s=read(socket,((char *)&buffer)+signs,(sizeof buffer)-signs))==0) X { printf("** %s: BROKEN PIPE\n",getenv("HOST")); X fflush(stdin); X exit(0); X }; X signs+=s; X }; X X buffer=ntohs(buffer); X return(buffer); X} X Xwriteshort(socket,number) X int socket; X short number; X{ short buffer; X X buffer=htons(number); X write(socket,&buffer,sizeof buffer); X} X Xwritestring(socket,string) X int socket; X char *string; X{ int len; X X writeint(socket,len=strlen(string)); X write(socket,string,len); X} X Xreadstring(socket,buffer,maxlen) X int socket,maxlen; X char *buffer; X{ int len,signs; X X len=readint(socket); X X signs=0; X while(signs<len) X signs+=read(socket,buffer+signs,len-signs); X buffer[len]='\0'; X} X Xshow_addr(host,sin) X char *host; X struct sockaddr_in *sin; X{ X printf("%s: %d %d %ld\n",host,(int)(sin->sin_family),(int)(ntohs(sin->sin_port)),sin->sin_addr.s_addr); X fflush(stdout); X} X Xinit_addr(sin,hostname,port) X struct sockaddr_in *sin; X char *hostname; X short port; X{ Xstruct hostent *hp; X X if ((hp=gethostbyname(hostname))==NULL) X { fprintf(stderr,"*** %s: Host not found. (%s)\n",getenv("HOST"),hostname); X exit(0); X }; X bzero(sin,sizeof *sin); X sin->sin_family=AF_INET; X sin->sin_port=port; X bcopy(hp->h_addr,&sin->sin_addr,hp->h_length); X} X Xint connect_to(socket,hostname,port) X int socket; X char *hostname; X short port; X{ Xstruct sockaddr_in sin; X X init_addr(&sin,hostname,port); X if (connect(socket,&sin,sizeof sin)<0) X { fprintf(stderr,"*** %s: Connection to %s/%d refused.\n",getenv("HOST"),hostname,(int)ntohs(port)); X exit(0); X }; X} END_OF_FILE if test 2729 -ne `wc -c <'helps.c'`; then echo shar: \"'helps.c'\" unpacked with wrong size! fi # end of 'helps.c' fi if test -f 'texter.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'texter.c'\" else echo shar: Extracting \"'texter.c'\" \(4239 characters\) sed "s/^X//" >'texter.c' <<'END_OF_FILE' X/* This program was written by Helmut Hoenig */ X/* in May of 1988 at the Unitversity of */ X/* Kaiserslautern, Germany. It may be copied freely. */ X X#include <X11/Xlib.h> X#include <stdio.h> X X#include "header.h" X X/***************************** X * externe globale Variablen * X *****************************/ X Xextern Display *display; Xextern Screen *screen; X Xextern XEvent event; XWindow aw; /* Eingabe-/Ausgabefenster */ X XGC gc_copy,gc_copyInverted; /* Graphik-Kontexte */ XGC gc_or,gc_orInverted,gc_xor; XGC gc_clear,gc_set; XGC gc_filler; XGC gc_root; X X#define MAXID 2 X XXFontStruct *finfo[MAXID]; /* Zeiger auf FontInfo-Strukturen der geladenen Fonts */ Xint floaded[MAXID]; X X/************** X * Prozeduren * X **************/ X Xopenfont(name,fid) /*f font <name> eroeffnen mit Nummer <fid> */ X char *name; X int fid; X X{ if ((fid >= 0) && (fid < MAXID)) X { closefont(fid); X if ((finfo[fid]=XLoadQueryFont(display,name)) == NULL) X { fprintf(stderr,"** Unable to load font %s\n",name); X exit(-1); X }; X floaded[fid]=1; X }; X} X Xclosefont(fid) /*f font mit Nummer <fid> schliessen */ X int fid; X X{ if ((fid >=0) && (fid < MAXID)) X if (floaded[fid]==1) X { XFreeFont(display,finfo[fid]); X floaded[fid]=0; X } X} X Xinit_texter() X{ Xint reverse; Xint mw=XRootWindowOfScreen(screen); X X openfont(FONT_NAME,0); X reverse = (XBlackPixelOfScreen(screen)==0)?1:0; X X/* Standard-GC setzen */ X gc_copy = DefaultGCOfScreen(screen); X XSetState(display,gc_copy,1,0,(reverse)?GXcopyInverted:GXcopy,AllPlanes); X XSetLineAttributes(display,gc_copy,0,LineSolid,CapButt,JoinBevel); X XSetGraphicsExposures(display,gc_copy,0); X X/* Invers-GC setzen */ X gc_copyInverted=XCreateGC(display,mw,(unsigned long)0,NULL); X XCopyGC(display,gc_copy,(long)-1,gc_copyInverted); X XSetFunction(display,gc_copyInverted,(reverse)?GXcopy:GXcopyInverted); X X/* GC_clear setzen */ X gc_clear=XCreateGC(display,mw,(unsigned long)0,NULL); X XCopyGC(display,gc_copy,(long)-1,gc_clear); X XSetFunction(display,gc_clear,(reverse)?GXset:GXclear); X X/* GC_set setzen */ X gc_set=XCreateGC(display,mw,(unsigned long)0,NULL); X XCopyGC(display,gc_copy,(long)-1,gc_set); X XSetFunction(display,gc_set,(reverse)?GXclear:GXset); X X/* OR-GC setzen */ X gc_or=XCreateGC(display,mw,(unsigned long)0,NULL); X XCopyGC(display,gc_copy,(long)-1,gc_or); X XSetFunction(display,gc_or,(reverse)?GXandInverted:GXor); X XSetFont(display,gc_or,finfo[0]->fid); X X/* ORInverted-GC setzen */ X gc_orInverted=XCreateGC(display,mw,(unsigned long)0,NULL); X XCopyGC(display,gc_or,(long)-1,gc_orInverted); X XSetFunction(display,gc_orInverted,(reverse)?GXor:GXandInverted); X X/* XOR-GC setzen */ X gc_xor=XCreateGC(display,mw,(unsigned long)0,NULL); X XCopyGC(display,gc_copy,(long)-1,gc_xor); X XSetFunction(display,gc_xor,GXxor); X X/* root-GC setzen */ X gc_root=XCreateGC(display,mw,(unsigned long)0,NULL); X XCopyGC(display,gc_xor,(long)-1,gc_root); X XSetSubwindowMode(display,gc_root,IncludeInferiors); X X/* filler-GC setzen */ X gc_filler=XCreateGC(display,mw,(unsigned long)0,NULL); X XCopyGC(display,gc_copy,(long)-1,gc_filler); X XSetFunction(display,gc_filler,(reverse)?GXcopyInverted:GXcopy); X XSetFillStyle(display,gc_filler,FillTiled); X XSetTSOrigin(display,gc_filler,0,0); X} X Xprintcleared(x,y,string,fid) /*f Text an Zeichenposition x,y ausgeben (Hintergrund wird geloescht) */ X int x,y,fid; X char *string; X{ X XFillRectangle(display,aw,gc_clear,x * CharWidth(fid),y * CharHeight(fid),StringWidth(string,fid),CharHeight(fid)); X printat(x,y,string,fid); X} X Xprintat(x,y,string,fid) /*f Text an Zeichenposition x,y ausgeben */ X int x,y,fid; X char *string; X{ X XSetFont(display,gc_or,finfo[fid]->fid); X XDrawString(display,aw,gc_or, X x * CharWidth(fid),y * CharHeight(fid) + finfo[fid]->ascent,string,strlen(string)); X} X Xprint(x,y,string,fid) /*f Text an Position x,y ausgeben */ X int x,y,fid; X char *string; X{ X XSetFont(display,gc_or,finfo[fid]->fid); X XDrawString(display,aw,gc_or, X x,y+finfo[fid]->ascent,string,strlen(string)); X} X Xtext(x,y,string,fid) /*f Text zentriert ausgeben (Hintergrund loeschen) */ X int x,y,fid; X char *string; X X{ int xs,ys; X X XSetFont(display,gc_or,finfo[fid]->fid); X XDrawString(display,aw,gc_or,x-(StringWidth(string,fid)>>1),y+(finfo[fid]->ascent>>1),string,strlen(string)); X} END_OF_FILE if test 4239 -ne `wc -c <'texter.c'`; then echo shar: \"'texter.c'\" unpacked with wrong size! fi # end of 'texter.c' fi if test -f 'header.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'header.h'\" else echo shar: Extracting \"'header.h'\" \(394 characters\) sed "s/^X//" >'header.h' <<'END_OF_FILE' X/************************ X * globale Definitionen * X ************************/ X X#define ROOT XRootWindowOfScreen(screen) X#define DHeight HeightOfScreen(screen) X#define DWidth WidthOfScreen(screen) X X#define CharWidth(id) (finfo[id]->max_bounds.width) X#define CharHeight(id) (finfo[id]->descent + finfo[id]->ascent) X#define StringWidth(string,id) XTextWidth(finfo[id],string,strlen(string)) END_OF_FILE if test 394 -ne `wc -c <'header.h'`; then echo shar: \"'header.h'\" unpacked with wrong size! fi # end of 'header.h' fi if test -f 'messages.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'messages.h'\" else echo shar: Extracting \"'messages.h'\" \(132 characters\) sed "s/^X//" >'messages.h' <<'END_OF_FILE' X#define EXIT 0 X#define GAMESTART 1 X#define SCORE 2 X#define PLAYER_READY 4 X#define DESTROYED 8 X#define UNMAP 16 X#define ERROR 32 END_OF_FILE if test 132 -ne `wc -c <'messages.h'`; then echo shar: \"'messages.h'\" unpacked with wrong size! fi # end of 'messages.h' fi if test -f 'grey_maps.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'grey_maps.h'\" else echo shar: Extracting \"'grey_maps.h'\" \(1804 characters\) sed "s/^X//" >'grey_maps.h' <<'END_OF_FILE' X#define grey0_width 16 X#define grey0_height 16 Xstatic short grey0_bits[] = { X 0x0000, 0x0000, 0x0000, 0x0000, X 0x0000, 0x0000, 0x0000, 0x0000, X 0x0000, 0x0000, 0x0000, 0x0000, X 0x0000, 0x0000, 0x0000, 0x0000}; X#define grey1_width 16 X#define grey1_height 16 Xstatic short grey1_bits[] = { X 0x9249, 0x4924, 0x2492, 0x9249, X 0x4924, 0x2492, 0x9249, 0x4924, X 0x2492, 0x9249, 0x4924, 0x2492, X 0x9249, 0x4924, 0x2492, 0x9249}; X#define grey2_width 16 X#define grey2_height 16 Xstatic short grey2_bits[] = { X 0x6db6, 0xb6db, 0xdb6d, 0x6db6, X 0xb6db, 0xdb6d, 0x6db6, 0xb6db, X 0xdb6d, 0x6db6, 0xb6db, 0xdb6d, X 0x6db6, 0xb6db, 0xdb6d, 0x6db6}; X#define grey3_width 16 X#define grey3_height 16 Xstatic short grey3_bits[] = { X 0x3333, 0x3333, 0xcccc, 0xcccc, X 0x3333, 0x3333, 0xcccc, 0xcccc, X 0x3333, 0x3333, 0xcccc, 0xcccc, X 0x3333, 0x3333, 0xcccc, 0xcccc}; X#define grey4_width 16 X#define grey4_height 16 Xstatic short grey4_bits[] = { X 0x9249, 0x2492, 0x4924, 0x9249, X 0x2492, 0x4924, 0x9249, 0x2492, X 0x4924, 0x9249, 0x2492, 0x4924, X 0x9249, 0x2492, 0x4924, 0x9249}; X#define grey5_width 16 X#define grey5_height 16 Xstatic short grey5_bits[] = { X 0x5555, 0xaaaa, 0x5555, 0xaaaa, X 0x5555, 0xaaaa, 0x5555, 0xaaaa, X 0x5555, 0xaaaa, 0x5555, 0xaaaa, X 0x5555, 0xaaaa, 0x5555, 0xaaaa}; X#define grey6_width 16 X#define grey6_height 16 Xstatic short grey6_bits[] = { X 0xeeee, 0xbbbb, 0xeeee, 0xbbbb, X 0xeeee, 0xbbbb, 0xeeee, 0xbbbb, X 0xeeee, 0xbbbb, 0xeeee, 0xbbbb, X 0xeeee, 0xbbbb, 0xeeee, 0xbbbb}; X#define grey7_width 16 X#define grey7_height 16 Xstatic char grey7_bits[] = { X 0xd6, 0x5a, 0x29, 0xa5, 0xd6, 0x5a, 0xd6, 0x5a, 0x29, 0xa5, 0xd6, 0x5a, X 0xd6, 0x5a, 0x29, 0xa5, 0xd6, 0x5a, 0xd6, 0x5a, 0x29, 0xa5, 0xd6, 0x5a, X 0xd6, 0x5a, 0x29, 0xa5, 0xd6, 0x5a, 0xd6, 0x5a}; END_OF_FILE if test 1804 -ne `wc -c <'grey_maps.h'`; then echo shar: \"'grey_maps.h'\" unpacked with wrong size! fi # end of 'grey_maps.h' fi echo shar: End of shell archive. echo '*** Think of changing the TRON_RUN_FILE-Macro in the makefile ! ***' exit 0