diff options
author | Ian C <ianc@noddybox.co.uk> | 2020-05-12 21:08:42 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2020-05-12 21:08:42 +0000 |
commit | c4a574a2ed490a9ec77efc1392260ee4305f1fbf (patch) | |
tree | 7ff4118df5c1231870c1cc63f56365b52a356ce2 | |
parent | 0270a28cf6dcf0ebeff0e4d51b17c17fe195160e (diff) |
Builds, just, and runs.
-rw-r--r-- | Makefile | 27 | ||||
-rw-r--r-- | README | 64 | ||||
-rw-r--r-- | Xbit.c | 1876 | ||||
-rw-r--r-- | Xbit.h | 596 | ||||
-rw-r--r-- | fontset.h | 2020 | ||||
-rw-r--r-- | galax.c | 1888 | ||||
-rw-r--r-- | icon | 27 | ||||
-rw-r--r-- | sprdef.h | 517 |
8 files changed, 7015 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c5e5493 --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +# Makfile +# +OPTS=-g +OBJ=galax +CC=cc + +# Paths to X11 includes and libraries. Edit as appropriate for your system +# +DIRS=-L/usr/openwin/lib -I/usr/openwin/include -L/usr/X11R6/lib + +# Add on -lsocket for solaris 2 (and perhaps other SysV's) +# +LIB=-lXext -lX11 -lm + +ALL: $(OBJ) + +$(OBJ): Xbit.o $(OBJ).o + $(CC) $(OPTS) $(DIRS) -o $(OBJ) $(OBJ).o Xbit.o $(LIB) + +$(OBJ).o: Xbit.h $(OBJ).c + $(CC) $(OPTS) $(DIRS) -c $(OBJ).c + +Xbit.o: Xbit.c Xbit.h fontset.h + $(CC) $(OPTS) $(DIRS) -c Xbit.c + +clean: + rm -f Xbit.o $(OBJ).o $(OBJ) core hisc.gal @@ -0,0 +1,64 @@ + Galax 1.4 + Presented by Noddybox 97 + +You should find in the archive : + +README This file +Makefile Simple bog standard make file for galax +galax.c Main code +sprdef.h Sprite definitions +Xbit.[ch] Library routines for easy X11 Xlib access +fontset.h XImage font definitions for Xbit library +icon Icon for Xbit library + + +BUILD INSTRUCTIONS +------------------ + +Though written under SunOS, it should compile OK on most flavours of unix. + + +USAGE +----- + +galax [-noshm] [scale] - Use scale to magnify and impact overly fast servers. + Use -noshm as well if your server is still too fast + to disable MIT-SHM usage. (Note shm usage will be + disabled if your server doesn't support it anyway). + +GALAX KEYS +---------- + +Z Left +C Right +. Shoot +Q Quit (from title page), or quit back to title page +P Pause while playing + + +INSTRUCTIONS +------------ + +Shoot everything that looks vaguely ET shaped. + + +NOTES +----- + +galax switches off auto repeat to enhance the keyboard reading when running. +Auto repeat is re-enabled when you exit the game cleanly from the title page. + +If you kill it mid-game, auto repeat will still be off. It can be re-enabled +from the shell with 'xset r on'. + + + +Have Fun. + + + +email ianc@noddybox.demon.co.uk +URL http://www.noddybox.demon.co.uk + + +Release 1.4 Wed Nov 12 11:24:23 GMT 1997 @@ -0,0 +1,1876 @@ +/* + + Xbit - Simple xlib interface + + Copyright (C) 2005 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + + This is a bit messy as it based on very old K&R code. + +*/ +static char rcs_id[]="$Id: Xbit.c 11 2006-05-02 19:02:49Z ianc $"; + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xos.h> +#include <X11/Xatom.h> + +#include <X11/extensions/XShm.h> + +/* #include <machine/param.h> */ +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/shm.h> + +#include <stdlib.h> +#include <stdio.h> +#include <fcntl.h> +#include <string.h> +#include <stdarg.h> + +#include <netinet/in.h> + +#include "Xbit.h" + +#include "icon" + +#define WARN(x) fprintf(stderr,"%s(%d) : Warning:%s\n",__FILE__,__LINE__,x); +#define WARN1(x,y) fprintf(stderr,"%s(%d) : Warning:%s %s\n",__FILE__,__LINE__,x,y); + + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#define ABS(x) ((x) < 0 ? (-(x)) : (x)) + + +/* GLOBALS +*/ + +#define MAXPM 256 + +typedef struct WEntry +{ + Window w; + Pixmap pm[MAXPM]; + int used_MIT_SHM; + XShmSegmentInfo + shm_info; + int pmi; + int buffer; + int use_pm; + int multi; + int multino; + ulong multicls; + GC gc; + int ox; + int oy; + int ww; + int wh; + int pw; + int ph; + int func; + int lastuserfunc; + ulong lastfg; + int spline_thresh; + struct WEntry *next; +} WEntry; + + +static WEntry *whead=NULL; +static WEntry *wtail=NULL; + +static WEntry *current=NULL; + +static WEntry *stack[128]; +static int sttop; + +static Display *display=NULL; +static XVisualInfo vinfo; +static int screen; + +static int use_shm=True; + +static ulong xb_black; +static ulong xb_white; + +/* Buffer for Xprintf() and XIprintf() +*/ +static char prbuf[1024]; + +/* Definitions for XImage 8x8 charset +*/ +#include "fontset.h" + + +/* Put globals +*/ +static int no_plots; +static XPoint points[MAX_PUTPLOTS]; + + +/* Set write mode +*/ +#define WM(c) do {if ((c)!=current->func) { \ + XSetFunction(display,current->gc,c); \ + current->func=c; } } while(0) + + +/* Set foreground funcrion +*/ +#define FG(c) do {if ((c)!=current->lastfg) { \ + XSetForeground(display,current->gc,c); \ + current->lastfg=c; } } while(0) + + +/* Stack current windows +*/ +#define PUSHW do {stack[sttop++]=current;} while(0) +#define POPW do {current=stack[--sttop];} while(0) + + +/* ------------- FUNCTIONS ------------- */ + +static void CreateWEntry(Window w, GC g, int ww, int wh) +{ + WEntry *new; + + if (!(new=malloc(sizeof(WEntry)))) + { + fprintf(stderr,"%s(%d) : FATAL:%s\n",__FILE__,__LINE__, + "Couldn't malloc() WEntry"); + exit(1); + } + + if (!whead) + { + whead=new; + wtail=new; + } + else + { + wtail->next=new; + wtail=new; + } + + new->next=NULL; + + new->w=w; + new->gc=g; + + new->pm[0]=0; + new->pm[1]=0; + new->pmi=0; + new->buffer=True; + new->use_pm=True; + new->multi=False; + new->ox=0; + new->oy=0; + new->ww=ww; + new->wh=wh; + new->pw=0; + new->ph=0; + new->func=GXcopy; + new->lastuserfunc=GXcopy; + new->lastfg=-1; + new->spline_thresh=1; + new->used_MIT_SHM=False; +} + + +XImage *CreateXImage(void) +{ + XImage *img; + char *p; + + if (!use_shm) + { + switch(vinfo.depth) + { + case 8: + p=malloc(current->pw*current->ph*1); + break; + case 16: + p=malloc(current->pw*current->ph*2); + break; + default: + p=malloc(current->pw*current->ph*4); + break; + } + + if (!p) + { + fprintf(stderr,"%s(%d) : FATAL:%s\n",__FILE__,__LINE__, + "Couldn't malloc() XImage data"); + exit(1); + } + + img=XCreateImage + (display, + vinfo.visual, + vinfo.depth, /* Image depth */ + ZPixmap, /* Image format */ + 0, /* Offset */ + p, /* Data */ + current->pw, /* Width */ + current->ph, /* Height */ + 8, /* Bitmap pad */ + 0); + } + else + { + img=XShmCreateImage(display, + vinfo.visual, + vinfo.depth, + ZPixmap, + NULL, + &(current->shm_info), + current->pw, + current->ph); + + if (!img) + return(NULL); + + current->used_MIT_SHM=True; + + /* Get shared memory for image + */ + current->shm_info.shmid=shmget(IPC_PRIVATE, + img->bytes_per_line*img->height, + IPC_CREAT|0777); + + if (current->shm_info.shmid<0) + { + WARN("Couldn't get MITSHM mem"); + exit(1); + } + + current->shm_info.shmaddr=shmat(current->shm_info.shmid,0,0); + img->data=current->shm_info.shmaddr; + + current->shm_info.readOnly=False; + + /* Try and attached shared memory + */ + if (!XShmAttach(display,&(current->shm_info))) + { + WARN("Failed to attach MITSHM block"); + exit(1); + } + + XSync(display,False); + } + + ClsXImage(img); + return img; +} + + +void ClsXImage(XImage *img) +{ + memset(img->data,0,img->bytes_per_line*img->height); +} + + +void DestroyXImage(XImage *img) +{ + if (current->used_MIT_SHM) + { + XShmDetach(display,&(current->shm_info)); + + if (current->shm_info.shmaddr) + shmdt(current->shm_info.shmaddr); + + if (current->shm_info.shmid>=0) + shmctl(current->shm_info.shmid,IPC_RMID,0); + + current->used_MIT_SHM=False; + } + + XDestroyImage(img); + XSync(display,False); +} + + +void SetCurrentWin(Window w) +{ + WEntry *l; + + l=whead; + + while(l) + { + if (l->w==w) + { + current=l; + return; + } + + l=l->next; + } + + WARN("Asked for non-existant window"); +} + + +int GetVisualDepth(void) +{ + return vinfo.depth; +} + + +Window OpenWin (int argc, + char **argv, + char *title, + int wx, int wy, int ww, int wh, + int pw, int ph, + unsigned long ev, + XSizeHints *hints, + ulong *black, ulong *white) +{ + Window window; + GC gc; + char *display_name=NULL; + Pixmap icon_pixmap; + int i,j,k; + + if (!display) + { + if ((display=XOpenDisplay(display_name))==NULL) + { + fprintf(stderr,"%s: can't connect to %s\n", + argv[0], XDisplayName(display_name)); + exit(-1); + } + + /* Try and find shared memory extension + */ + use_shm=XQueryExtension(display,"MIT-SHM",&i,&j,&k); + + /* Find a nice 8-bit visual for us to use... + */ + if (!XMatchVisualInfo(display,DefaultScreen(display),8, + PseudoColor,&vinfo)) + if (!XMatchVisualInfo(display,DefaultScreen(display),16, + TrueColor,&vinfo)) + if (!XMatchVisualInfo(display,DefaultScreen(display),24, + TrueColor,&vinfo)) + if (!XMatchVisualInfo(display,DefaultScreen(display),32, + TrueColor,&vinfo)) + { + WARN("no visual found!\n"); + exit(1); + } + } + + screen=DefaultScreen(display); + + xb_black=BlackPixel(display,screen); + xb_white=WhitePixel(display,screen); + *black=xb_black; + *white=xb_white; + + window=XCreateWindow(display, + RootWindow(display,screen), + wx,wy,ww,wh,1, + vinfo.depth, + InputOutput, + vinfo.visual, + 0,NULL); + + icon_pixmap=XCreateBitmapFromData( + display, + window, + icon_bits, + icon_width,icon_height); + + XSetStandardProperties( + display, + window, + title, + title, + icon_pixmap, + argv,argc, + hints); + + XSelectInput (display,window,ev); + + gc=XCreateGC(display,window,0,NULL); + + XSetForeground(display,gc,*black); + XSetBackground(display,gc,*white); + XSetPlaneMask(display,gc,AllPlanes); + XSetGraphicsExposures(display,gc,False); + + XMapWindow (display,window); + + CreateWEntry(window,gc,ww,wh); + SetCurrentWin(window); + + Resize(pw,ph); + + return window; +} + + +Window OpenRootWin (ulong *black,ulong *white,int *w,int *h,int pw,int ph) +{ + Window window; + GC gc; + char *display_name=NULL; + int i,j,k; + + if (!display) + { + int depth; + + if ((display=XOpenDisplay(display_name))==NULL) + { + fprintf(stderr,"can't connect to %s\n",XDisplayName(display_name)); + exit(-1); + } + + screen=DefaultScreen(display); + + depth=DefaultDepth(display,screen); + + /* Try and find shared memory extension + */ + use_shm=XQueryExtension(display,"MIT-SHM",&i,&j,&k); + + /* Find a visual for us to use... + */ + if (!XMatchVisualInfo(display,DefaultScreen(display),depth, + depth==8 ? PseudoColor:TrueColor,&vinfo)) + { + WARN("no visual to match the root window!"); + exit(1); + } + } + + xb_black=BlackPixel(display,screen); + xb_white=WhitePixel(display,screen); + *black=xb_black; + *white=xb_white; + + window=RootWindow(display,screen); + + gc=XCreateGC(display,window,0,NULL); + + XSetForeground(display,gc,*black); + XSetBackground(display,gc,*white); + XSetPlaneMask(display,gc,AllPlanes); + + XMapWindow (display,window); + + *w=DisplayWidth(display,screen); + *h=DisplayHeight(display,screen); + + CreateWEntry(window,gc,*w,*h); + SetCurrentWin(window); + + Resize(pw,ph); + + return window; +} + + +XFontStruct *XUseFont(const char *n) +{ + XFontStruct *ft; + + if (ft=XLoadQueryFont(display,n)) + XSetFont(display,current->gc,ft->fid); + else + WARN1("couldn't load font:",n); + + return ft; +} + + +void XUseCursor(const char *bm, const char *mask, XColor fg, XColor bg) +{ + Pixmap b,m; + Cursor curs; + int bmw,bmh,bmx,bmy; + int maskw,maskh,maskx,masky; + + if (XReadBitmapFile(display,current->w,bm,&bmw,&bmh,&b,&bmx,&bmy) + ==BitmapOpenFailed) + { + WARN1("Couldn't read in cursor file:",bm); + return; + } + + if (XReadBitmapFile(display,current->w,mask,&maskw,&maskh,&m,&maskx,&masky) + ==BitmapOpenFailed) + { + WARN1("Couldn't read in mask file:",bm); + return; + } + + curs=XCreatePixmapCursor(display,b,m,&fg,&bg,bmx,bmy); + + XDefineCursor(display,current->w,curs); + + XFreePixmap(display,b); + XFreePixmap(display,m); +} + + +void LoadBitmap(const char *fn,int x,int y, int resize) +{ + Pixmap bm; + int w,h,hx,hy; + int cw,ch; + + if (!current->use_pm) + { + WARN("Need pixmaps to load in bitmap"); + } + + if (XReadBitmapFile(display,current->w,fn,&w,&h,&bm,&hx,&hy) + ==BitmapOpenFailed) + { + WARN1("Couldn't read in bitmap file:",fn); + return; + } + + if ((w!=current->pw)||(h!=current->ph)) + { + if (resize) + { + Resize(w+x,h+y); + cw=w; + ch=h; + } + else + { + cw=current->pw-x; + ch=current->ph-y; + } + } + + XCopyPlane(display,bm,current->pm[current->pmi], + current->gc,0,0,cw,ch,x,y,1L); + + XFreePixmap(display,bm); +} + + +Pixmap GetBitmap(const char *fn, int *w, int *h, int *hx, int *hy) +{ + Pixmap bm,ret; + + if (XReadBitmapFile(display,current->w,fn,w,h,&bm,hx,hy) + ==BitmapOpenFailed) + { + WARN1("Couldn't read in bitmap file:",fn); + return(0); + } + + ret=XCreatePixmap(display,current->w,*w,*h,vinfo.depth); + + XCopyPlane(display,bm,ret,current->gc,0,0,*w,*h,0,0,1L); + + XFreePixmap(display,bm); + + return ret; +} + + +void DrawXImage(XImage *img) +{ + if (use_shm) + XShmPutImage (display, + current->pm[0], + current->gc, + img, + 0,0, + 0,0, + current->pw,current->ph, + False); + else + XPutImage (display, + current->pm[0], + current->gc, + img, + 0,0, + 0,0, + current->pw,current->ph); +} + + +void Resize(int w,int h) +{ + int f; + + if (w<current->ww) + w=current->ww; + + if (h<current->wh) + h=current->wh; + + current->pw=w; + current->ph=h; + + if (!current->use_pm) + return; + + if (current->multi) + { + WM(GXcopy); + FG(current->multicls); + for(f=0;f<current->multino;f++) + { + XFreePixmap(display,current->pm[f]); + current->pm[f]=XCreatePixmap(display,current->w,w,h,vinfo.depth); + XFillRectangle(display,current->pm[f], + current->gc,0,0,current->pw,current->ph); + } + WM(current->lastuserfunc); + return; + } + + if (current->pm[0]) + { + XFreePixmap(display,current->pm[0]); + + if (current->buffer) + XFreePixmap(display,current->pm[1]); + } + + current->pmi=0; + + current->pm[0]=XCreatePixmap(display,current->w,w,h,vinfo.depth); + + if (current->buffer) + current->pm[1]=XCreatePixmap(display,current->w,w,h,vinfo.depth); +} + + +void Redraw(int x,int y) +{ + if ((x+current->ww)>current->pw) + x=current->pw-current->ww; + + if ((y+current->wh)>current->ph) + y=current->ph-current->wh; + + current->ox=x; + current->oy=y; + + if (!current->use_pm) + { + XSync(display,False); + return; + } + + WM(GXcopy); + + if (current->buffer) + { + XCopyArea(display,current->pm[current->pmi^1],current->w, + current->gc,x,y,current->ww,current->wh,0,0); + XSync(display,False); + } + else + { + XCopyArea(display,current->pm[current->pmi],current->w, + current->gc,x,y,current->ww,current->wh,0,0); + XSync(display,False); + } + + WM(current->lastuserfunc); +} + + +Pixmap GetCurrentPixmap(void) + +{ + if (!current->use_pm) + return(0); + + return current->pm[current->pmi]; +} + +GC GetCurrentGC(void) + +{ + return current->gc; +} + + +void DisableDoubleBuffer(void) + +{ + current->pmi=0; + XFreePixmap(display,current->pm[1]); + current->buffer=False; +} + + +void DisablePixmap(void) + +{ + current->pmi=0; + + if (current->use_pm) + XFreePixmap(display,current->pm[0]); + + if (current->buffer) + XFreePixmap(display,current->pm[1]); + + current->buffer=False; + current->use_pm=False; + current->pm[0]=current->w; +} + + +void DisableShm(void) +{ + use_shm=False; +} + + +void EnableBuffers(int no, ulong clscol) +{ + int f; + + current->pmi=0; + + if (current->use_pm) + XFreePixmap(display,current->pm[0]); + + if (current->buffer) + XFreePixmap(display,current->pm[1]); + + current->buffer=False; + current->use_pm=True; + current->multi=True; + + if (no>MAXPM) + current->multino=MAXPM; + else + current->multino=no; + + current->multicls=clscol; + + WM(GXcopy); + FG(current->multicls); + for(f=0;f<current->multino;f++) + { + current->pm[f]=XCreatePixmap(display,current->w,current->ww,current->wh, + vinfo.depth); + XFillRectangle(display,current->pm[f], + current->gc,0,0,current->pw,current->ph); + } + + WM(current->lastuserfunc); +} + + +void Pageflip(void) +{ + if (current->buffer) + current->pmi=current->pmi^1; + + if (current->multi) + if ((++current->pmi)>=current->multino) + current->pmi=0; +} + + +void SetAsBackdrop(void) +{ + XSetWindowBackgroundPixmap (display, current->w, current->pm[current->pmi]); + XSync(display,False); +} + + +void XUseFunction(int f) +{ + WM(f); + current->lastuserfunc=f; +} + + +void XSetLineStyle(unsigned int w, int ls, int cs, int js) +{ + XSetLineAttributes(display,current->gc,w,ls,cs,js); +} + + +void XCls(ulong c) +{ + if (current->use_pm) + { + WM(GXcopy); + FG(c); + XFillRectangle(display,current->pm[current->pmi], + current->gc,0,0,current->pw,current->ph); + WM(current->lastuserfunc); + } + else + { + /* + XSetBackground(display,current->gc,c); + XClearWindow(display,current->pm[0]); + */ + WM(GXcopy); + FG(c); + XFillRectangle(display,current->pm[current->pmi], + current->gc,0,0,current->pw,current->ph); + WM(current->lastuserfunc); + } +} + + +void XPlot(int x,int y, ulong c) +{ + FG(c); + XDrawPoint(display,current->pm[current->pmi],current->gc,x,y); +} + + +void XLine(int x1,int y1,int x2,int y2, ulong c) +{ + FG(c); + XDrawLine(display,current->pm[current->pmi],current->gc,x1,y1,x2,y2); +} + + +void SetSplineThresh(int t) +{ + current->spline_thresh=t; +} + + +static void XDoSpline(int x0,int y0,int x1,int y1,int x2,int y2,ulong c) +{ + int xa, ya, xb, yb, xc, yc, xp, yp; + + if ((x0==x1==x2)&&(y0==y1==y2)) + { + XPlot(x0,y0,c); + return; + } + + if ((x0==x1)&&(y0==y1)) + { + XLine(x1,y1,x2,y2,c); + return; + } + + if ((x0==x2)&&(y0==y2)) + { + XLine(x0,y0,x1,y1,c); + return; + } + + if ((x1==x2)&&(y1==y2)) + { + XLine(x0,y0,x2,y2,c); + return; + } + + xa = ( x0 + x1 ) / 2; + ya = ( y0 + y1 ) / 2; + xc = ( x1 + x2 ) / 2; + yc = ( y1 + y2 ) / 2; + xb = ( xa + xc ) / 2; + yb = ( ya + yc ) / 2; + + xp = ( x0 + xb ) / 2; + yp = ( y0 + yb ) / 2; + + if ( ABS( xa - xp ) + ABS( ya - yp ) > current->spline_thresh ) + XDoSpline(x0,y0,xa,ya,xb,yb,c); + else + XDrawLine(display,current->pm[current->pmi],current->gc,x0,y0,xb,yb); + + xp = ( x2 + xb ) / 2; + yp = ( y2 + yb ) / 2; + if ( ABS( xc - xp ) + ABS( yc - yp ) > current->spline_thresh ) + XDoSpline(xb,yb,xc,yc,x2,y2,c); + else + XDrawLine(display,current->pm[current->pmi],current->gc,xb,yb,x2,y2); +} + + +void XSpline(int x1,int y1,int x2,int y2,int x3,int y3,ulong c) +{ + FG(c); + + if ((x1==x2==x3)&&(y1==y2==y3)) + { + XPlot(x1,y1,c); + return; + } + + if ((x1==x2)&&(y1==y2)) + { + XLine(x2,y2,x3,y3,c); + return; + } + + if ((x1==x3)&&(y1==y3)) + { + XLine(x1,y1,x2,y2,c); + return; + } + + if ((x2==x3)&&(y2==y3)) + { + XLine(x1,y1,x3,y3,c); + return; + } + + XDoSpline(x1,y1,x2,y2,x3,y3,c); +} + + +void XPrint(int x,int y, const char *s, ulong c) + +{ + FG(c); + XDrawString(display,current->pm[current->pmi],current->gc,x,y,s,strlen(s)); +} + + +void Xprintf(int x, int y, ulong colour, const char *fmt, ...) +{ + va_list va; + + va_start(va,fmt); + vsprintf(prbuf,fmt,va); + va_end(va); + + FG(colour); + XDrawString(display,current->pm[current->pmi],current->gc, + x,y,prbuf,strlen(prbuf)); +} + + +void XISetFont(XImageFont n) +{ + switch(n) + { + case XI_FONT1: + xifont=xifont1; + break; + case XI_FONT2: + xifont=xifont2; + break; + } +} + + +static void XIPlot(XImage *img,int x,int y, ulong c) +{ + if ((y<0)||(y>=img->height)||(x<0)||(x>=img->width)) + return; + + XPutPixel(img,x,y,c); +} + + +void XIprintf(XImage *img, int x, int y, int sx, int sy, ulong col, + const char *fmt, ...) +{ + int f,px,py,psx,psy,ch; + char *data; + va_list arg; + + va_start(arg,fmt); + vsprintf(prbuf,fmt,arg); + va_end(arg); + + if ((sx==1)&&(sy==1)) + { + for(f=0;f<strlen(prbuf);f++) + { + ch=prbuf[f]; + + for(py=0;py<XIFONTH;py++) + if ((y+py>=0)&&(y+py<img->height)) + for(px=0;px<XIFONTW;px++) + if ((x+px>=0)&&(x+px<img->width)) + if (xifont[ch].data[py][px]) + XPutPixel(img,x+px,y+py,col); + + x+=XIFONTW; + } + } + else + { + for(f=0;f<strlen(prbuf);f++) + { + ch=prbuf[f]; + + for(py=0;py<XIFONTH;py++) + for(px=0;px<XIFONTW;px++) + if (xifont[ch].data[py][px]) + for(psx=0;psx<sx;psx++) + for(psy=0;psy<sy;psy++) + XPutPixel(img,x+px*sx+psx,y+py*sy+psy,col); + + x+=XIFONTW*sx; + } + } +} + + +void XBox(int x,int y,int w,int h,ulong c) +{ + FG(c); + XDrawRectangle(display,current->pm[current->pmi],current->gc,x,y,w,h); +} + + +void XFillBox(int x,int y,int w,int h,ulong c) +{ + FG(c); + XFillRectangle(display,current->pm[current->pmi],current->gc,x,y,w,h); +} + + +void XCircle(int x,int y,int rx,int ry,int a1,int a2,ulong c) +{ + FG(c); + XDrawArc(display,current->pm[current->pmi],current->gc,x,y,rx,ry,a1,a2); +} + + +void XFillCircle(int x,int y,int rx,int ry,int a1,int a2,ulong c) +{ + FG(c); + XFillArc(display,current->pm[current->pmi],current->gc,x,y,rx,ry,a1,a2); +} + + +void XStartPlots(void) +{ + no_plots=0; +} + + +void XAddPlot(int x,int y) +{ + points[no_plots].x=x; + points[no_plots].y=y; + + no_plots++; +} + + +void XPutPlots(ulong c) +{ + FG(c); + XDrawPoints(display,current->pm[current->pmi],current->gc, + points,no_plots,CoordModeOrigin); +} + + +void XPutPlotsAsLines(ulong c) +{ + FG(c); + XDrawLines(display,current->pm[current->pmi],current->gc, + points,no_plots,CoordModeOrigin); +} + + +void XFillPoly(XPoint *xp,int n,int shape,ulong c) +{ + FG(c); + XFillPolygon(display,current->pm[current->pmi],current->gc,xp,n, + shape,CoordModeOrigin); +} + + +void XScroll(int dx,int dy) +{ + int destx,desty,srcx,srcy; + int w,h; + + if (dx>=0) + { + destx=0; + srcx=dx; + w=current->pw-dx; + } + + if (dx<0) + { + destx=-(dx); + srcx=0; + w=current->pw+dx; + } + + if (dy>=0) + { + desty=0; + srcy=dy; + h=current->ph-dy; + } + + if (dy<0) + { + desty=-(dy); + srcy=0; + h=current->ph+dy; + } + + WM(GXcopy); + XCopyArea(display,current->pm[current->pmi],current->pm[current->pmi], + current->gc,srcx,srcy,current->pw-dx,current->ph,destx,desty); + WM(current->lastuserfunc); +} + + +void XCopy(int sx,int sy,int w,int h,int dx,int dy) +{ + WM(GXcopy); + XCopyArea(display,current->pm[current->pmi],current->pm[current->pmi], + current->gc,sx,sy,current->pw,current->ph,dx,dy); + WM(current->lastuserfunc); +} + + +void XPut(Pixmap spm,int sx,int sy,int w,int h,int dx,int dy) +{ + WM(GXcopy); + XCopyArea(display,spm,current->pm[current->pmi], + current->gc,sx,sy,w,h,dx,dy); + WM(current->lastuserfunc); +} + + +void XGet(Pixmap dpm,int sx,int sy,int w,int h,int dx,int dy) +{ + WM(GXcopy); + XCopyArea(display,dpm,current->pm[current->pmi], + current->gc,sx,sy,w,h,dx,dy); + WM(current->lastuserfunc); +} + + +void ScreenCopy(void) +{ + if (current->buffer) + { + WM(GXcopy); + XCopyArea(display,current->pm[current->pmi^1], + current->pm[current->pmi],current->gc,0,0, + current->pw,current->ph,0,0); + WM(current->lastuserfunc); + } +} + + +Display *GetDisplay(void) +{ + return display; +} + + + +void XFinished(void) +{ + XCloseDisplay(display); +} + + +void XDoTillButtonPress(XVoidCallback func) +{ + XEvent event; + int ignore=True; + + while (True) + if (XPending(display)) + { + XNextEvent(display,&event); + + switch (event.type) + { + case Expose: + if (event.xexpose.count) + break; + Redraw(current->ox,current->oy); + break; + + case ButtonPress: + if (event.xbutton.button) + if (!ignore) + return; + break; + } + } + else + if (func) + switch (func()) + { + case XFUNCCONT: + ignore=False; + break; + + case XFUNCIGNORE: + ignore=True; + break; + + case XFUNCSTOP: + return; + break; + } + +} + + +void XDoMouse(XButtonCallback button, XMoveCallBack move, XVoidCallback process) +{ + XEvent event; + + while (True) + if ((XPending(display))||(!process)) + { + XNextEvent(display,&event); + + switch (event.type) + { + case Expose: + if (event.xexpose.count) + break; + Redraw(current->ox,current->oy); + break; + + case MotionNotify: + if (move) + switch(move(event.xmotion.window, + event.xmotion.x,event.xmotion.y)) + { + case XFUNCSTOP: + return; + break; + } + break; + + case ButtonPress: + if (button) + switch(button(event.xbutton.window,XPRESS, + event.xbutton.button, + event.xbutton.x,event.xbutton.y)) + { + case XFUNCSTOP: + return; + break; + } + break; + } + } + else + if (process) + switch (process()) + { + case XFUNCCONT: + case XFUNCIGNORE: + break; + + case XFUNCSTOP: + return; + break; + } + +} + + +static int IsMoveWin(Window w, XWindowMoveCallBack call[] ,int *i) +{ + int f; + + if (!call) + { + return(False); + } + + f=0; + + while(call[f].w) + { + if (call[f].w==w) + { + *i=f; + return call[f].func ? True:False; + } + else + { + f++; + } + } + + return False; +} + + +static int IsButtonWin(Window w, XWindowButtonCallback call[] ,int *i) +{ + int f; + + if (!call) + { + return(False); + } + + f=0; + + while(call[f].w) + { + if (call[f].w==w) + { + *i=f; + return call[f].func ? True:False; + } + else + { + f++; + } + } + + return False; +} + + +static int IsKeyWin(Window w, XWindowKeyCallback call[] ,int *i) +{ + int f; + + if (!call) + { + return(False); + } + + f=0; + + while(call[f].w) + { + if (call[f].w==w) + { + *i=f; + return call[f].func ? True:False; + } + else + { + f++; + } + } + + return False; +} + + +void XDoWindows(XWindowButtonCallback button[], + XWindowMoveCallBack move[], + XWindowKeyCallback key[], + XVoidCallback process) +{ + int i; + XEvent event; + + while (True) + if ((XPending(display))||(!process)) + { + XNextEvent(display,&event); + + switch (event.type) + { + case Expose: + if (event.xexpose.count) + break; + + PUSHW; + SetCurrentWin(event.xexpose.window); + Redraw(current->ox,current->oy); + POPW; + + break; + + case MotionNotify: + if (IsMoveWin(event.xmotion.window,move,&i)) + { + switch(move[i].func(event.xmotion.window, + event.xmotion.x, + event.xmotion.y)) + { + case XFUNCSTOP: + return; + break; + } + } + break; + + case ButtonPress: + if (IsButtonWin(event.xbutton.window,button,&i)) + { + switch(button[i].func + (event.xbutton.window, + XPRESS, + event.xbutton.button, + event.xbutton.x,event.xbutton.y)) + { + case XFUNCSTOP: + return; + break; + } + } + break; + + case ButtonRelease: + if (IsButtonWin(event.xbutton.window,button,&i)) + { + switch(button[i].func + (event.xbutton.window, + XRELEASE, + event.xbutton.button, + event.xbutton.x,event.xbutton.y)) + { + case XFUNCSTOP: + return; + break; + } + } + break; + + case KeyPress: + if (IsKeyWin(event.xkey.window,key,&i)) + { + switch(key[i].func(event.xkey.window, + XPRESS, + &event)) + { + case XFUNCSTOP: + return; + break; + } + } + break; + + case KeyRelease: + if (IsKeyWin(event.xkey.window,key,&i)) + { + switch(key[i].func(event.xkey.window, + XRELEASE, + &event)) + { + case XFUNCSTOP: + return; + break; + } + } + break; + + default: + break; + } + } + else + if (process) + { + switch (process()) + { + case XFUNCCONT: + case XFUNCIGNORE: + break; + + case XFUNCSTOP: + return; + break; + } + } +} + + +/* Sprite routines */ +void LoadSprite(const char *fn, XSprite *spr, const XColor xc[256]) +{ + Pixmap piximg,pixmask,pixsave; + int fd,x,y; + char magic[11]; + unsigned char *data,*p; + unsigned short us; + GC gc; + + if ((fd=open(fn,O_RDONLY))==-1) + { + WARN1("Couldn't open sprite file",fn); + return; + } + + read(fd,magic,11); + + if (strncmp(magic,"XbitSprite",10)) + { + WARN1(fn,"is not a sprite file!"); + close(fd); + return; + } + + spr->x=spr->y=0; + + read(fd,&us,sizeof(unsigned short)); + spr->w=ntohs(us); + read(fd,&us,sizeof(unsigned short)); + spr->h=ntohs(us); + + if (!(data=malloc(spr->w*spr->h))) + { + WARN("Couldn't grab memory for sprite image"); + close(fd); + return; + } + + if (read(fd,data,spr->w*spr->h)!=spr->w*spr->h) + { + WARN("Couldn't load sprite image"); + close(fd); + free(data); + return; + } + + close(fd); + + gc=XCreateGC(display,current->w,0,NULL); + + XSetPlaneMask(display,gc,AllPlanes); + XSetGraphicsExposures(display,gc,False); + + piximg=XCreatePixmap(display,current->w,spr->w,spr->h,vinfo.depth); + pixmask=XCreatePixmap(display,current->w,spr->w,spr->h,vinfo.depth); + pixsave=XCreatePixmap(display,current->w,spr->w,spr->h,vinfo.depth); + + p=data; + + for(y=0;y<spr->h;y++) + { + for(x=0;x<spr->w;x++) + { + XSetForeground(display,gc,xc[*p].pixel); + XDrawPoint(display,piximg,gc,x,y); + + if (*p) + XSetForeground(display,gc,xb_white); + else + XSetForeground(display,gc,xb_black); + + XDrawPoint(display,pixmask,gc,x,y); + + p++; + } + } + + spr->data=piximg; + spr->mask=pixmask; + spr->save=pixsave; + + free(data); +} + + +void XDrawSprites(XSprite *spr[],int no, XSpriteControl ctl) +{ + int f; + + WM(GXcopy); + + if (!(ctl&XSPRNOSAVE)) + for(f=0;f<no;f++) + if (current->buffer) + { + spr[f]->lx=spr[f]->x; + spr[f]->ly=spr[f]->y; + XCopyArea(display,current->pm[current->pmi^1], + spr[f]->save,current->gc,spr[f]->x,spr[f]->y, + spr[f]->w,spr[f]->h,0,0); + } + else + { + spr[f]->lx=spr[f]->x; + spr[f]->ly=spr[f]->y; + XCopyArea(display,current->pm[current->pmi], + spr[f]->save,current->gc,spr[f]->x,spr[f]->y, + spr[f]->w,spr[f]->h,0,0); + } + + WM(GXand); + for(f=0;f<no;f++) + if (current->buffer) + XCopyArea(display,spr[f]->mask,current->pm[current->pmi^1], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y); + else + XCopyArea(display,spr[f]->mask,current->pm[current->pmi], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y); + + WM(GXor); + for(f=0;f<no;f++) + if (current->buffer) + XCopyArea(display,spr[f]->data,current->pm[current->pmi^1], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y); + else + XCopyArea(display,spr[f]->data,current->pm[current->pmi], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y); + + WM(current->lastuserfunc); +} + + +void XEraseSprites(XSprite *spr[],int no) +{ + int f; + + WM(GXcopy); + + for(f=0;f<no;f++) + if (current->buffer) + XCopyArea(display,spr[f]->save,current->pm[current->pmi^1], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->lx,spr[f]->ly); + else + XCopyArea(display,spr[f]->save,current->pm[current->pmi], + current->gc,0,0, + spr[f]->w,spr[f]->h,spr[f]->lx,spr[f]->ly); + + WM(current->lastuserfunc); +} + + +void LoadColormap(const char *fn, XColor xc[256]) +{ + int fd,f; + unsigned short us; + + if ((fd=open(fn,O_RDONLY))==-1) + { + WARN1("Couldn't open cmap",fn); + return; + } + + for(f=0;f<256;f++) + { + xc[f].pixel=f; + xc[f].flags=DoRed|DoGreen|DoBlue; + read(fd,&us,sizeof(unsigned short)); + xc[f].red=ntohs(us); + read(fd,&us,sizeof(unsigned short)); + xc[f].green=ntohs(us); + read(fd,&us,sizeof(unsigned short)); + xc[f].blue=ntohs(us); + } +} + + +void AllocColors(int no,ulong pix[],const char *name[]) +{ + int f,col; + XColor xc; + + for(f=0;f<no;f++) + { + if (XParseColor(display,DefaultColormap(display,screen),name[f],&xc)) + { + if (XAllocColor(display,DefaultColormap(display,screen),&xc)) + pix[f]=xc.pixel; + else + { + WARN1("couldn't allocate",name[f]); + + col=0; + + if (xc.flags&DoRed) + col+=xc.red; + + if (xc.flags&DoBlue) + col+=xc.blue; + + if (xc.flags&DoGreen) + col+=xc.green; + + if (col>(0x8000*3)) + { + WARN("defaulting to white"); + pix[f]=WhitePixel(display,screen); + } + else + { + WARN("defaulting to black"); + pix[f]=BlackPixel(display,screen); + } + } + } + else + { + WARN1("not a color ",name[f]); + pix[f]=WhitePixel(display,screen); + } + } +} + + +void AllocColorsRGB(int no, ulong pix[], const Colour col[]) +{ + int f; + XColor xc; + + for(f=0;f<no;f++) + { + xc.red=col[f].r; + xc.green=col[f].g; + xc.blue=col[f].b; + xc.flags=DoRed|DoBlue|DoGreen; + + if (XAllocColor(display,DefaultColormap(display,screen),&xc)) + pix[f]=xc.pixel; + else + { + WARN("couldn't allocate RGB color"); + + if ((col[f].r+col[f].g+col[f].b)>(0x8000*3)) + { + WARN("defaulting to white"); + pix[f]=WhitePixel(display,screen); + } + else + { + WARN("defaulting to black"); + pix[f]=BlackPixel(display,screen); + } + } + } +} + + +void LoadSpriteDataSet (const char *cmapfn, + const char *sprfn[], + SpriteDataSet *set) +{ + int f,r,fd; + char magic[11]; + XColor xcol[256]; + Colour col[256]; + SpriteData *spr; + int no; + int used[256]; + unsigned short us; + unsigned char byte; + + + /* Allocate referenced table + */ + for(f=0;f<256;f++) + used[f]=-1; + + /* Count and allocate referenced sprites + */ + no=0; + while(sprfn[no]) + no++; + + /* Load in colourmap + */ + LoadColormap(cmapfn,xcol); + + set->no_col=0; + set->no_spr=no; + + /* Load in sprites and sort out colour usage + */ + spr=malloc(sizeof(SpriteData)*no); + + for(f=0;f<no;f++) + { + if ((fd=open(sprfn[f],O_RDONLY))==-1) + { + WARN1("Couldn't open sprite file",sprfn[f]); + exit(1); + return; + } + + read(fd,magic,11); + + if (strncmp(magic,"XbitSprite",10)) + { + WARN1(sprfn[f],"is not a sprite file!"); + exit(1); + return; + } + + read(fd,&us,sizeof(unsigned short)); + spr[f].w=ntohs(us); + read(fd,&us,sizeof(unsigned short)); + spr[f].h=ntohs(us); + + if (!(spr[f].data=malloc(spr[f].w*spr[f].h))) + { + WARN("Couldn't grab memory for sprite image"); + exit(1); + } + + /* Read through pixel values, stacking up colour definitions as neeed + */ + for(r=0;r<(spr[f].w*spr[f].h);r++) + { + read(fd,&byte,1); + + if (used[byte]==-1) + { + col[set->no_col].r=xcol[byte].red; + col[set->no_col].g=xcol[byte].green; + col[set->no_col].b=xcol[byte].blue; + + used[byte]=set->no_col++; + } + + spr[f].data[r]=used[byte]; + } + + close(fd); + } + + /* Got all sprites - allocate and remap colours + */ + AllocColoursRGB(set->no_col,set->pix,col); + + /* Remap sprites + */ + for(f=0;f<no;f++) + for(r=0;r<(spr[f].w*spr[f].h);r++) + spr[f].data[r]=set->pix[spr[f].data[r]]; + + /* Set up return, all done + */ + set->spr=spr; +} + + +/* END OF FILE */ @@ -0,0 +1,596 @@ +/* + + lunar - Simple X11 Lunar Lander + + Copyright (C) 2005 Ian Cowburn (ianc@noddybox.demon.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------- + +*/ + +#ifndef XBIT_H +#define XBIT_H "$Id: Xbit.h 7 2005-05-13 01:01:08Z ianc $" + + +/* + Version 2 of the Bitmap manipulation library for X + + Now supports : + + Multiple windows + Pixmaps bigger than the window + Mutiple pixmap buffers (upto a maxim of 256 per window) + XImage print routines + Better XImage support, defaulting to shared memory usage. + + IMPORTANT NOTES ON MIT-SHM SUPPORT : + + 1. Only call CreateXImage() ONCE per window. + + 2. If you wish resources to be freed properly on completion, it + is important that DestroyXImage() is called before exiting + with the window the XImage was created in relation to set + as the current window. + + 3. Allow the user to toggle MIT-SHM from a switch, as if the + server supports it, but using it is failing for some other + reason, then your program will be unable to run. + +*/ +#include <X11/X.h> +#include <X11/Xlib.h> + + +/* Just as I'm a lazy typer +*/ +typedef unsigned char uchar; +typedef unsigned long ulong; + + +/* Maximums for PutPlots() +*/ +#define MAX_PUTPLOTS 4096 + + +/* Types and constants +*/ +#define MIN_ANG 0 +#define MAX_ANG 23040 + +typedef enum +{ + XFUNCCONT, + XFUNCIGNORE, + XFUNCSTOP +} XFuncControl; + +typedef struct +{ + int x,y; + unsigned short w,h; + int lx,ly; /* This field is 'private' */ + Pixmap data; /* This field is 'private' */ + Pixmap mask; /* This field is 'private' */ + Pixmap save; /* This field is 'private' */ +} XSprite; + +typedef enum +{ + XSPRSAVE, + XSPRNOSAVE +} XSpriteControl; + + +typedef struct +{ + int r,g,b; +} Colour; + +typedef Colour Color; + + +typedef enum +{ + XPRESS, + XRELEASE +} XPressRelease; + + +typedef XFuncControl (*XVoidCallback)(void); +typedef XFuncControl (*XMoveCallBack)(Window w, int x, int y); +typedef XFuncControl (*XButtonCallback)(Window w, XPressRelease mode, + int button, int x, int y); +typedef XFuncControl (*XKeyCallback)(Window w, XPressRelease mode, + XEvent *event); + +typedef struct +{ + Window w; + XMoveCallBack func; +} XWindowMoveCallBack; + +typedef struct +{ + Window w; + XButtonCallback func; +} XWindowButtonCallback; + +typedef struct +{ + Window w; + XKeyCallback func; +} XWindowKeyCallback; + + +/* XImage font defs +*/ +typedef enum +{ + XI_FONT1, + XI_FONT2 +} XImageFont; + + +/* Portable sprite data definitions - allows sprite data and colormap data to + be read from a list of files, returning + an array of RGB triplets defining the + colormap, and array of pixels + corresponding to those colours and a + series of sprite images with converted + pixel values. This means you can use + data normally read in just for the + XSprite routines on any format of display + mechanism. +*/ +#define SPRD_AT(spr,x,y) (*(spr.data+(x)+((y)*(spr.w)))) + +typedef struct +{ + int w,h; /* Width, height */ + ulong *data; /* Data */ +} SpriteData; + +typedef struct +{ + int no_col; /* No of colours used by sprites */ + ulong pix[256]; /* Array of pixel values */ + int no_spr; + SpriteData *spr; /* Array of sprite data */ +} SpriteDataSet; + + +/* Function Prototypes +*/ + +Window OpenWin + ( + int argc, + char *argv[], + char *title, + int Win_X, + int Win_Y, + int Win_Width, + int Win_Height, + int Pix_Width, + int Pix_Height, + unsigned long event_mask, + XSizeHints *hints, + ulong *black, + ulong *white + ); + +Window OpenRootWin + ( + ulong *black, ulong *white, + int *w, int *h, int Pix_Width, int Pix_Height + ); + +void SetCurrentWin + ( + Window w + ); + +int GetVisualDepth(void); + +XImage *CreateXImage(void); + +void ClsXImage + ( + XImage *img + ); + +void DestroyXImage + ( + XImage *img + ); + +XFontStruct + *XUseFont + ( + const char *font_name + ); + +void XUseCursor + ( + const char *bitmap_filename, + const char *mask_filename, + XColor fg, + XColor bg + ); + +void SetAsBackdrop(void); + +void DisableDoubleBuffer(void); + +void DisablePixmap(void); + +void DisableShm(void); + +void EnableBuffers + ( + int no, + ulong clscol + ); + +void LoadBitmap + ( + const char *fn, + int x, + int y, + int resize + ); + +Pixmap GetBitmap + ( + const char *fn, + int *width, + int *height, + int *hot_x, + int *hot_y + ); + +/* These 2 are for manipulating your own XImage structures +*/ +Pixmap GetCurrentPixmap(void); +GC GetCurrentGC(void); + +void Redraw + ( + int off_x, + int off_y + ); + +void DrawXImage + ( + XImage *img + ); + +/* Note that if this used with EnableBuffers() on, this will move to the next + buffer +*/ +void Pageflip(void); + +void Resize + ( + int pix_w, + int pix_h + ); + +void XSetLineStyle + ( + unsigned int line_width, + int line_style, + int cap_style, + int join_style + ); + +void XUseFunction + ( + int GC_function + ); + +void XCls + ( + ulong colour + ); + +void XPlot + ( + int x, + int y, + ulong colour + ); + +void XLine + ( + int x1, + int y1, + int x2, + int y2, + ulong colour + ); + +void SetSplineThresh + ( + int thresh + ); + +void XSpline + ( + int x1, + int y1, + int x2, + int y2, + int x3, + int y3, + ulong colour + ); + +void XPrint + ( + int x, + int y, + const char *string, + ulong colour + ); + +void Xprintf + ( + int x, + int y, + ulong colour, + const char *fmt, + ... + ); + +void XISetFont + ( + XImageFont font_no + ); + +void XIprintf + ( + XImage *img, + int x, + int y, + int scale_x, + int scale_y, + ulong colour, + const char *fmt, + ... + ); + +void XBox + ( + int x, + int y, + int w, + int h, + ulong colour + ); + +void XFillBox + ( + int x, + int y, + int w, + int h, + ulong colour + ); + +void XCircle + ( + int x, + int y, + int rx, + int ry, + int ang1, + int ang2, + ulong colour + ); + +void XFillCircle + ( + int x, + int y, + int rx, + int ry, + int ang1, + int ang2, + ulong colour + ); + +void XStartPlots(void); + +void XAddPlot + ( + int x, + int y + ); + +void XPutPlots + ( + ulong col + ); + +void XPutPlotsAsLines + ( + ulong col + ); + +void XFillPoly + ( + XPoint xp[], + int no_points, + int shape, + ulong col + ); + +void XScroll + ( + int dx, + int dy + ); + +void XCopy + ( + int srcx, + int srcy, + int w, + int h, + int destx, + int desty + ); + +void XPut + ( + Pixmap src, + int srcx, + int srcy, + int w, + int h, + int destx, + int desty + ); + +void XGet + ( + Pixmap dest, + int srcx, + int srcy, + int w, + int h, + int destx, + int desty + ); + +void ScreenCopy(void); + +Display *GetDisplay(void); + +void XFinished(void); + +/* The following event routines expect mouse events to be set in the + event mask */ + +void XDoTillButtonPress + ( + XVoidCallback func + ); + +void XDoMouse + ( + XButtonCallback mouse_button, + XMoveCallBack mouse_movement, + XVoidCallback process + ); + +void XDoWindows + ( + XWindowButtonCallback mouse_button[], + XWindowMoveCallBack mouse_movement[], + XWindowKeyCallback key_press[], + XFuncControl (*process) () + ); + + +/* Sprite routines */ +void LoadSprite + ( + const char *filename, + XSprite *sprite, + const XColor xc[256] + ); + + +void XDrawSprites + ( + XSprite *sprites[], + int no, + XSpriteControl control + ); + +void XEraseSprites + ( + XSprite *sprites[], + int no + ); + +void LoadColormap + ( + const char *filename, + XColor xc[256] + ); + +#define AllocColors AllocColours +void AllocColours + ( + int no, + ulong pixels[], + const char *colname[] + ); + +#define AllocColorsRGB AllocColoursRGB +void AllocColoursRGB + ( + int no, + ulong pixels[], + const Colour cols[] + ); + +void LoadSpriteDataSet + ( + const char *cmap_filename, + const char *sprite_filenames[], + SpriteDataSet *set + ); + + +/* + + File Formats: + + NB: all ushorts are stored in network format. See ntohs(3). + + Colormap: + + red.ushort - Red component color 0 + green.ushort - Red component color 0 + blue.ushort - Red component color 0 + ... + ... + red.ushort - Red component color 255 + green.ushort - Red component color 255 + blue.ushort - Red component color 255 + + + Sprite: + + "XbitSprite" - Magic string (NULL terminated) + width.ushort - width of sprite + height.ushort - height of sprite + byte.uchar - Pixel value for (0,0) + byte.uchar - Pixel value for (1,0) + ... + ... + byte.uchar - Pixel value for (width-1,height-1) + +*/ + +#endif + +/* END OF FILE */ diff --git a/fontset.h b/fontset.h new file mode 100644 index 0000000..8f58fcd --- /dev/null +++ b/fontset.h @@ -0,0 +1,2020 @@ +#ifndef XIFONTW + +#define XIFONTW 8 +#define XIFONTH 8 + +#define NULLCHARDEF {{ \ + {1,1,1,1,1,1,1,0,}, \ + {1,0,0,0,0,0,1,0,}, \ + {1,0,1,1,1,0,1,0,}, \ + {1,0,1,0,1,0,1,0,}, \ + {1,0,1,1,1,0,1,0,}, \ + {1,0,0,0,0,0,1,0,}, \ + {1,1,1,1,1,1,1,0,}, \ + {0,0,0,0,0,0,0,0,}, \ + }} + +typedef struct + { + char data[XIFONTH][XIFONTW]; + } FontChar; + +FontChar xifont1[128] = + { + NULLCHARDEF, /* 00 */ + NULLCHARDEF, /* 01 */ + NULLCHARDEF, /* 02 */ + NULLCHARDEF, /* 03 */ + NULLCHARDEF, /* 04 */ + NULLCHARDEF, /* 05 */ + NULLCHARDEF, /* 06 */ + NULLCHARDEF, /* 07 */ + NULLCHARDEF, /* 08 */ + NULLCHARDEF, /* 09 */ + NULLCHARDEF, /* 0a */ + NULLCHARDEF, /* 0b */ + NULLCHARDEF, /* 0c */ + NULLCHARDEF, /* 0d */ + NULLCHARDEF, /* 0e */ + NULLCHARDEF, /* 0f */ + NULLCHARDEF, /* 10 */ + NULLCHARDEF, /* 11 */ + NULLCHARDEF, /* 12 */ + NULLCHARDEF, /* 13 */ + NULLCHARDEF, /* 14 */ + NULLCHARDEF, /* 15 */ + NULLCHARDEF, /* 16 */ + NULLCHARDEF, /* 17 */ + NULLCHARDEF, /* 18 */ + NULLCHARDEF, /* 19 */ + NULLCHARDEF, /* 1a */ + NULLCHARDEF, /* 1b */ + NULLCHARDEF, /* 1c */ + NULLCHARDEF, /* 1d */ + NULLCHARDEF, /* 1e */ + NULLCHARDEF, /* 1f */ + + {{ /* 20 ' ' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 21 '!' */ + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 22 '"' */ + {0,1,1,0,0,1,1,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 23 '#' */ + {0,1,1,0,1,1,0,0,}, + {0,1,1,0,1,1,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 24 '$' */ + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,1,1,1,0,}, + {0,1,0,1,1,0,0,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,1,1,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 25 '%' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,1,1,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 26 '&' */ + {0,1,1,1,1,0,0,0,}, + {1,1,0,0,1,1,0,0,}, + {1,1,0,0,1,1,0,0,}, + {0,1,1,1,1,0,0,0,}, + {1,1,0,0,1,0,1,0,}, + {1,1,0,0,0,1,0,0,}, + {0,1,1,1,1,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 27 ''' */ + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 28 '(' */ + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 29 ')' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2a '*' */ + {0,0,0,0,0,0,0,0,}, + {0,1,0,1,0,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,0,1,0,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2b '+' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2c ',' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + }}, + {{ /* 2d '-' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2e '.' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2f '/' */ + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + }}, + {{ /* 30 '0' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 31 '1' */ + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 32 '2' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 33 '3' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 34 '4' */ + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,1,1,1,0,0,0,}, + {1,1,0,1,1,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 35 '5' */ + {1,1,1,1,1,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 36 '6' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 37 '7' */ + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 38 '8' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 39 '9' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3a ':' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3b ';' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3c '<' */ + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3d '=' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3e '<' */ + {0,1,1,0,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3f '?' */ + {0,0,1,1,1,1,0,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 40 '@' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,0,0,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 41 'A' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 42 'B' */ + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 43 'C' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 44 'D' */ + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 45 'E' */ + {1,1,1,1,1,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 46 'F' */ + {1,1,1,1,1,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 47 'G' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 48 'H' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 49 'I' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4a 'J' */ + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4b 'K' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4c 'L' */ + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4d 'M' */ + {1,1,0,0,0,1,1,0,}, + {1,1,1,0,1,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4e 'N' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,0,0,1,1,0,}, + {1,1,1,1,0,1,1,0,}, + {1,1,0,1,1,1,1,0,}, + {1,1,0,0,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4f 'O' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 50 'P' */ + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 51 'Q' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,1,1,1,1,0,}, + {1,1,0,0,1,1,0,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 52 'R' */ + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 53 'S' */ + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 54 'T' */ + {0,1,1,1,1,1,1,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 55 'U' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 56 'V' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 57 'W' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,1,0,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 58 'X' */ + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 59 'Y' */ + {0,1,1,0,0,1,1,0,}, + {0,1,1,0,0,1,1,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5a 'Z' */ + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5b '[' */ + {0,0,1,1,1,1,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5c '\' */ + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + }}, + {{ /* 5d ']' */ + {0,0,1,1,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5e '^' */ + {0,0,0,1,0,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5f '_' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,1,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 60 '`' */ + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 61 'a' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 62 'b' */ + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 63 'c' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 66 'd' */ + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 66 'e' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 66 'f' */ + {0,0,1,1,1,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 67 'g' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 68 'h' */ + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 69 'i' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6a 'j' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6b 'k' */ + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,1,1,0,0,}, + {1,1,0,1,1,0,0,0,}, + {1,1,1,1,0,0,0,0,}, + {1,1,0,1,1,0,0,0,}, + {1,1,0,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6c 'l' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6d 'm' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,1,1,0,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6e 'n' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6f 'o' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 70 'p' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + }}, + {{ /* 71 'q' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,0,1,1,0,}, + }}, + {{ /* 72 'r' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,1,1,1,0,0,}, + {1,1,1,0,0,1,1,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 73 's' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 74 't' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 75 'u' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 76 'v' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 77 'w' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,1,0,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {0,1,1,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 78 'x' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,1,0,0,0,1,1,0,}, + {1,1,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 79 'y' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,0,0,1,1,0,}, + {0,1,1,0,0,1,1,0,}, + {0,0,1,1,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7a 'z' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7b '{' */ + {0,0,0,1,1,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,1,1,0,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7c '|' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7d '}' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,0,1,1,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,0,1,1,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7e '~' */ + {0,0,1,1,0,0,1,1,}, + {0,1,1,1,1,1,1,0,}, + {1,1,0,0,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7f DEL */ + {0,1,1,0,1,1,0,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + }; + + + +FontChar xifont2[128] = + { + NULLCHARDEF, /* 00 */ + NULLCHARDEF, /* 01 */ + NULLCHARDEF, /* 02 */ + NULLCHARDEF, /* 03 */ + NULLCHARDEF, /* 04 */ + NULLCHARDEF, /* 05 */ + NULLCHARDEF, /* 06 */ + NULLCHARDEF, /* 07 */ + NULLCHARDEF, /* 08 */ + NULLCHARDEF, /* 09 */ + NULLCHARDEF, /* 0a */ + NULLCHARDEF, /* 0b */ + NULLCHARDEF, /* 0c */ + NULLCHARDEF, /* 0d */ + NULLCHARDEF, /* 0e */ + NULLCHARDEF, /* 0f */ + NULLCHARDEF, /* 10 */ + NULLCHARDEF, /* 11 */ + NULLCHARDEF, /* 12 */ + NULLCHARDEF, /* 13 */ + NULLCHARDEF, /* 14 */ + NULLCHARDEF, /* 15 */ + NULLCHARDEF, /* 16 */ + NULLCHARDEF, /* 17 */ + NULLCHARDEF, /* 18 */ + NULLCHARDEF, /* 19 */ + NULLCHARDEF, /* 1a */ + NULLCHARDEF, /* 1b */ + NULLCHARDEF, /* 1c */ + NULLCHARDEF, /* 1d */ + NULLCHARDEF, /* 1e */ + NULLCHARDEF, /* 1f */ + + {{ /* 20 ' ' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 21 '!' */ + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 22 '"' */ + {0,0,1,0,0,1,0,0,}, + {0,0,1,0,0,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 23 '#' */ + {0,0,1,0,1,0,0,0,}, + {0,0,1,0,1,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,1,0,1,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 24 '$' */ + {0,0,0,1,0,0,0,0,}, + {0,0,1,1,1,1,0,0,}, + {0,1,0,1,0,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,0,1,0,0,}, + {0,1,1,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 25 '%' */ + {0,1,0,0,0,0,1,0,}, + {1,0,1,0,0,1,0,0,}, + {0,1,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,1,0,0,}, + {0,1,0,0,1,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 26 '&' */ + {0,1,1,1,0,0,0,0,}, + {1,0,0,0,1,0,0,0,}, + {1,0,0,0,1,0,0,0,}, + {0,1,1,1,0,0,0,0,}, + {1,0,0,0,1,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {0,1,1,1,1,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 27 ''' */ + {0,0,0,1,0,1,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 28 '(' */ + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 29 ')' */ + {0,0,1,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2a '*' */ + {1,0,0,1,0,0,1,0,}, + {0,1,0,1,0,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,0,1,0,1,0,0,}, + {1,0,0,1,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2b '+' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2c ',' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + }}, + {{ /* 2d '-' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2e '.' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 2f '/' */ + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 30 '0' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 31 '1' */ + {0,0,0,1,0,0,0,0,}, + {0,0,1,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 32 '2' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 33 '3' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 34 '4' */ + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,1,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 35 '5' */ + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 36 '6' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 37 '7' */ + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 38 '8' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 39 '9' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3a ':' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3b ';' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3c '<' */ + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3d '=' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3e '<' */ + {0,0,1,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 3f '?' */ + {0,0,1,1,1,1,0,0,}, + {0,1,0,0,0,0,1,0,}, + {0,0,0,0,1,1,1,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 40 '@' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,1,1,0,0,1,0,}, + {1,0,1,0,1,0,1,0,}, + {1,0,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 41 'A' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 42 'B' */ + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 43 'C' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 44 'D' */ + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 45 'E' */ + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 46 'F' */ + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 47 'G' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 48 'H' */ + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 49 'I' */ + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4a 'J' */ + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4b 'K' */ + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {1,0,0,0,1,0,0,0,}, + {1,1,1,1,0,0,0,0,}, + {1,0,0,0,1,0,0,0,}, + {1,0,0,0,0,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4c 'L' */ + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4d 'M' */ + {1,0,0,0,0,0,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,0,1,0,1,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4e 'N' */ + {1,0,0,0,0,0,1,0,}, + {1,1,0,0,0,0,1,0,}, + {1,0,1,0,0,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,0,0,1,0,1,0,}, + {1,0,0,0,0,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 4f 'O' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 50 'P' */ + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 51 'Q' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,1,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {0,1,1,1,1,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 52 'R' */ + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 53 'S' */ + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 54 'T' */ + {1,1,1,1,1,1,1,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 55 'U' */ + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 56 'V' */ + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 57 'W' */ + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,1,0,1,0,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 58 'X' */ + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,1,0,0,0,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 59 'Y' */ + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5a 'Z' */ + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5b '[' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5c '\' */ + {1,0,0,0,0,0,0,0,}, + {0,1,0,0,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5d ']' */ + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5e '^' */ + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 5f '_' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,1,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 60 '`' */ + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 61 'a' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 62 'b' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 63 'c' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 64 'd' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 65 'e' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 66 'f' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 67 'g' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 68 'h' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 69 'i' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6a 'j' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6b 'k' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {1,1,1,1,1,0,0,0,}, + {1,0,0,0,0,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6c 'l' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6d 'm' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,0,1,0,1,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6e 'n' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,0,0,0,0,1,0,}, + {1,0,1,0,0,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,0,0,1,0,1,0,}, + {1,0,0,0,0,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 6f 'o' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 70 'p' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 71 'q' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,1,0,1,0,}, + {1,0,0,0,0,1,0,0,}, + {0,1,1,1,1,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 72 'r' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 73 's' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {1,0,0,0,0,0,0,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 74 't' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 75 'u' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 76 'v' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 77 'w' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {1,0,0,1,0,0,1,0,}, + {1,0,1,0,1,0,1,0,}, + {1,1,0,0,0,1,1,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 78 'x' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,1,0,0,0,1,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 79 'y' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,0,0,0,0,0,1,0,}, + {0,1,0,0,0,1,0,0,}, + {0,0,1,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7a 'z' */ + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {1,1,1,1,1,1,1,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7b '{' */ + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,1,0,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7c '|' */ + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7d '}' */ + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7e '~' */ + {0,0,1,0,0,0,0,0,}, + {0,1,0,1,0,1,0,0,}, + {0,0,0,0,1,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + {{ /* 7f DEL */ + {0,1,1,0,1,1,0,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {1,1,1,1,1,1,1,0,}, + {0,1,1,1,1,1,0,0,}, + {0,0,1,1,1,0,0,0,}, + {0,0,0,1,0,0,0,0,}, + {0,0,0,0,0,0,0,0,}, + }}, + }; + +FontChar *xifont=xifont1; + +#endif @@ -0,0 +1,1888 @@ +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xos.h> +#include <X11/Xatom.h> +#include <X11/keysym.h> + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <fcntl.h> + +#include <unistd.h> + +#include "Xbit.h" + +#define WINX 100 +#define WINY 100 +#define WINW 220 +#define WINWH 110 +#define WINH 250 +#define WINHH 125 + +#define TAGLINE 242 + +#define RND(x) (rand()%(x)) + +#define ITOF(x) ((x)<<8) +#define FTOI(x) ((x)>>8) + +#define AT(p,x,y) *((p)+(x)+(y)*WINW) + +#define HISCFILE "hisc.gal" + +#define CH(x,y) ((x)*SCALE),((y)*SCALE),SCALE,SCALE + +XSizeHints size_hints; +int black,white; +Display *disp; +Window top,sub; +Colormap cm; +XFontStruct *font; +XImage *img; +char *data; +char *coll_data; + +double si[3600],co[3600]; + +static XFuncControl Key(Window w, XPressRelease s, XEvent *e); +static XFuncControl ProcessTitle(void),ProcessIntro(void),ProcessGame(void), + ProcessGameOver(void),ProcessHiScore(void), + ProcessStartLevel(void); + +/* Hiscore +*/ +#define NOHI 10 + +typedef struct + { + char name[4]; + int score; + int level; + double percent; + } HiSc; + +HiSc hisc[NOHI]= + { + {"A.B",10000,1,50.0}, + {"C.D",5000,1,50.0}, + {"E.F",3000,1,50.0}, + {"G.H",1500,1,50.0}, + {"I.J",1000,1,50.0}, + {"K.L",800,1,50.0}, + {"M.N",600,1,50.0}, + {"O.P",400,1,50.0}, + {"Q.R",200,1,50.0}, + {"S.T",100,1,50.0}, + }; + +/* Keycontrols +*/ +static XWindowKeyCallback key[2]= + { + {0,Key}, + {0,NULL} + }; + +#define NONE -1 +#define LEFT 0 +#define RIGHT 1 +#define FIRE 2 +#define QUIT 3 +#define PAUSE 4 + +int inkey=NONE; +KeySym last_keysym; +int keymap[PAUSE+1]={False,False,False,False,False}; + + +/* Sprite defs +*/ +#define SPRW 8 +#define SPRH 8 + +#define CHXSPR(a) ((a)*SPRW) + +#define SPRMAXANIM 10 +#define SPRANIMFRAME 10 + +unsigned int framectr =0; +unsigned int sprframe =0; + +typedef struct + { + ulong data[SPRH][SPRW]; + } SpriteDef; + +typedef struct + { + int no; + char data[SPRH*SPRW]; + } CollData; + +typedef struct + { + int no; + SpriteDef *spr[SPRMAXANIM]; + } SpriteAnim; + +#define NOSPR 11 + +#define SHIP 0 +#define ABULLET 1 +#define SBULLET 2 +#define GALAX1 3 +#define GALAX2 4 +#define GALAX3 5 +#define FLAG1 6 +#define FLAG10 7 +#define ENTITY1 8 +#define ALIENUFO 9 +#define SAFESHIP 10 + +#include "sprdef.h" + + +/* Collision data codes +*/ +#define CNONE 0 +#define CSHIP 1 +#define CALIEN 2 +#define CABULL 3 +#define CUBULLM 64 +#define CUBULL(x) (CUBULLM+(x)) + + +/* Alien data +*/ +#define NOSHOT 0 +#define SISHOT 1 +#define GASHOT 2 +#define VISHOT 3 + +typedef struct + { + int y; + int x; + int xi; + int yi; + int inuse; + } Shot; + +typedef struct + { + int alive; + int type; + Shot shot; + int x,y; + int sx,sy; /* Use for workspace for 'alternative' coords */ + } Alien; + + +#define MAXALIEN 100 +int no_aliens; +int aliens_alive; + +Alien alien[MAXALIEN]; + + +/* Explosion FX data +*/ +#define MAXEXP 20 +#define EXPPART 20 +#define EXPLIFE 10 +struct + { + int inuse; + int cx[EXPPART],cy[EXPPART],x[EXPPART],y[EXPPART]; + } exp_fx[MAXEXP]; + +int no_exp; + + +/* Level data +*/ +#define NOLEV 11 + +struct + { + char *title; + int sx,sy; + int shot_type; + } levdata[NOLEV]= + { + {"A CLASSIC...",0,1,SISHOT}, + {"RUN AWAY - WATCH YOUR BACK",1,-2,GASHOT}, + {"DIZZY",0,1,SISHOT}, + {"VICIOUS CARNIVAL DUCKS!",0,1,VISHOT}, + {"THE ALIEN WARFLEET - WAVE 1",-1,0,GASHOT}, + {"BOUNCY",0,1,GASHOT}, + {"THE 1ST COLLECTIVE",0,2,SISHOT}, + {"THE 2ND COLLECTIVE",0,2,SISHOT}, + {"THE 3RD COLLECTIVE",0,2,GASHOT}, + {"THE ALIEN WARFLEET - WAVE 2",-1,0,GASHOT}, + {"THE ALIEN MOTHERBRAIN",0,1,GASHOT}, + }; + + + +/* Colour vars +*/ +#define NOCOLS 8 +#define RNDCOL (RND(NOCOLS-2)+2) +#define RGB(r,g,b) {(r)*255,(g)*255,(b)*255} + +static ulong pix[NOCOLS]; +static Colour cols[NOCOLS]= + { + RGB(0,0,0), /* BLACK */ + RGB(255,255,255), /* WHITE */ + RGB(255,100,100), /* RED */ + RGB(100,255,100), /* GREEN */ + RGB(100,100,255), /* BLUE */ + RGB(255,255,0), /* YELLOW */ + RGB(0,255,255), /* CYAN */ + RGB(165,42,42) /* BROWN */ + }; + +#define BLACKI 0 +#define WHITEI 1 +#define REDI 2 +#define GREENI 3 +#define BLUEI 4 +#define YELLOWI 5 +#define CYANI 6 +#define BROWNI 7 + +#define BLACK pix[BLACKI] +#define WHITE pix[WHITEI] +#define RED pix[REDI] +#define GREEN pix[GREENI] +#define BLUE pix[BLUEI] +#define YELLOW pix[YELLOWI] +#define CYAN pix[CYANI] +#define BROWN pix[BROWNI] + + +/* Parallax vars +*/ +#define NOPLXST 30 +#define NOPLXPL 3 + +struct {int x,y,c} plxst[NOPLXST][NOPLXPL]; + + +/* User bullet vars +*/ +#define MAXBULL 100 +#define BULLYI -3 + +typedef struct + { + int inuse,x,y; + } UserBullet; + +UserBullet ubull[MAXBULL]; +int bullctr=0; + +/* Control vars +*/ +int NOLIVES =3; +int NOBULL =4; +int BULLDEL =10; +int LEVEL =0; +int SCORE =0; +int PAUSESKIP =0; +int FONT =0; + +int SCALE =1; +int POKEIMG_NS(),POKEIMG_S(); +int (*POKEIMG)(); + + +/* Game and control vars +*/ +#define SHXINIT WINW/2-SPRW/2 +#define SHIPY WINH-16 +#define BLYINIT SHIPY-8 + +int quit=False; + +int score,level,levelndx,lives; +int shipx,hit,miss,dead; +int aliendead; + + +int main(argc,argv) +int argc; +char *argv[]; + +{ + void IntrHandler(); + int f,r,x,y,arg,noshm; + unsigned long evmask; + + arg=1; + noshm=False; + + if (argc>arg) + if (!strcmp(argv[arg],"-noshm")) + { + noshm=True; + arg++; + } + + if (argc>arg) + { + SCALE=atoi(argv[arg]); + + if (SCALE<1) + { + fprintf(stderr,"scale param must be +ve\n"); + exit(1); + } + } + + if (SCALE==1) + POKEIMG=POKEIMG_NS; + else + POKEIMG=POKEIMG_S; + + for(f=0;f<NOPLXST;f++) + for(r=0;r<NOPLXPL;r++) + { + plxst[f][r].x=RND(WINW); + plxst[f][r].y=RND(WINH); + plxst[f][r].c=RNDCOL; + } + + for(f=0;f<3600;f++) + { + si[f]=sin(M_PI/1800.0*f); + co[f]=cos(M_PI/1800.0*f); + } + + umask(0); + srand(getpid()); + + size_hints.flags=PPosition|PSize|PMinSize|PMaxSize; + size_hints.x=WINX; + size_hints.y=WINY; + size_hints.width=size_hints.min_width=WINW*SCALE; + size_hints.height=size_hints.min_height=WINH*SCALE; + size_hints.max_width=WINW; + size_hints.max_height=WINH; + + evmask=KeyPressMask|KeyReleaseMask; + + top=OpenWin(argc,argv,argv[0], + WINX,WINY,WINW*SCALE,WINH*SCALE, + WINW*SCALE,WINH*SCALE, + evmask, + &size_hints,&black,&white); + + key[0].w=top; + + DisableDoubleBuffer(); + disp=GetDisplay(); + + DisablePixmap(); + + if (noshm) + DisableShm(); + + img=CreateXImage(); + + if (!(coll_data=(char *)malloc(WINW*WINH))) + { + fprintf(stderr,"Couldn't malloc() collision data\n"); + exit(1); + } + + AllocColoursRGB(NOCOLS,pix,cols); + + for(f=0;f<NOSPR;f++) + for(r=0;r<SPRMAXANIM;r++) + if (anim[f].spr[r]) + for(x=0;x<SPRW;x++) + for(y=0;y<SPRH;y++) + anim[f].spr[r]->data[y][x]= + pix[anim[f].spr[r]->data[y][x]]; + + XAutoRepeatOff(disp); + + XISetFont(FONT); + + ReadScores(); + + XDoWindows(NULL,NULL,key,ProcessTitle); + + while(!quit) + { + score=SCORE; + level=LEVEL; + levelndx=LEVEL%NOLEV; + lives=NOLIVES; + hit=0; + miss=0; + + do + { + shipx=SHXINIT; + dead=False; + + ClearBullets(); + ClearExplosions(); + ClearKeys(); + XDoWindows(NULL,NULL,key,ProcessStartLevel); + + DefineAliens(); + + ClearBullets(); + ClearExplosions(); + ClearKeys(); + XDoWindows(NULL,NULL,key,ProcessGame); + } while (lives>0); + + if (score>-1) + { + ClearBullets(); + ClearExplosions(); + ClearKeys(); + XDoWindows(NULL,NULL,key,ProcessGameOver); + + ReadScores(); + if (score>hisc[NOHI-1].score) + { + XDoWindows(NULL,NULL,key,ProcessHiScore); + WriteScores(); + } + } + + ClearKeys(); + XDoWindows(NULL,NULL,key,ProcessTitle); + } + + XAutoRepeatOn(disp); + DestroyXImage(img); + XCloseDisplay(disp); +} + + +/* ----------------------------------------------- KEY AND UTILITY +*/ +static XFuncControl Key(Window w, XPressRelease s, XEvent *e) +{ + if (s==XRELEASE) + { + last_keysym=XK_VoidSymbol; + + switch(XLookupKeysym((XKeyEvent *)e,ShiftMapIndex)) + { + case XK_Z: + case XK_z: + keymap[LEFT]=False; + break; + + case XK_C: + case XK_c: + keymap[RIGHT]=False; + break; + + case XK_period: + keymap[FIRE]=False; + break; + + case XK_P: + case XK_p: + keymap[PAUSE]=False; + break; + + case XK_Q: + case XK_q: + keymap[QUIT]=False; + break; + + default: + keymap[NONE]=False; + break; + } + } + + if (s==XPRESS) + { + inkey=NONE; + + switch(last_keysym=XLookupKeysym((XKeyEvent *)e,ShiftMapIndex)) + { + case XK_Z: + case XK_z: + inkey=LEFT; + break; + + case XK_C: + case XK_c: + inkey=RIGHT; + break; + + case XK_period: + inkey=FIRE; + break; + + case XK_P: + case XK_p: + inkey=PAUSE; + break; + + case XK_Q: + case XK_q: + inkey=QUIT; + break; + + default: + inkey=NONE; + break; + } + + if (inkey!=NONE) + keymap[inkey]=True; + } + + return (XFUNCCONT); +} + + +int GetKey() + +{ + int k=inkey; + + if ((inkey==PAUSE)||(inkey==QUIT)||(inkey=FIRE)) + inkey=NONE; + + return(k); +} + + +KeySym RawKey() + +{ + KeySym k=last_keysym; + + last_keysym=XK_VoidSymbol; + return(k); +} + + +ClearKeys() +{ + int f; + + inkey=NONE; + + for(f=0;f<5;f++) + keymap[f]=False; +} + + +/* ----------------------------------------------- GRAPHICS UTILS +*/ +Cls(plx,xi,yi,clr) +int plx,xi,yi,clr; + +{ + static unsigned int col; + int f,r,x,y; + + if (!((framectr++)%SPRANIMFRAME)) + { + sprframe++; + + for(f=0;f<NOSPR;f++) + spr[f]=anim[f].spr[sprframe%anim[f].no]; + } + + if (clr) + { + /* memset(data,black,WINW*WINH*SCALE*SCALE); */ + ClsXImage(img); + memset(coll_data,CNONE,WINW*WINH); + } + + if (plx) + { + col++; + + for(f=0;f<NOPLXST;f++) + for(r=0;r<NOPLXPL;r++) + { + plxst[f][r].y+=((r+1)*yi); + + if (plxst[f][r].y<0) + plxst[f][r].y+=WINH; + + if (plxst[f][r].y>=WINH) + plxst[f][r].y-=WINH; + + plxst[f][r].x+=((r+1)*xi); + + if (plxst[f][r].x<0) + plxst[f][r].x+=WINW; + + if (plxst[f][r].x>=WINW) + plxst[f][r].x-=WINW; + + if (!(col%10)) + plxst[f][r].c=RNDCOL; + + (*POKEIMG)(img,plxst[f][r].x,plxst[f][r].y,plxst[f][r].c); + } + } +} + + +Update() +{ + DrawXImage(img); + XSync(disp,False); +} + + +Centre(y,c,s) +int y,c; +char *s; + +{ + XIprintf(img,CH(WINWH-strlen(s)*4,y),c,"%s",s); +} + + +POKEIMG_NS(img,x,y,c) +XImage *img; +int x,y,c; + +{ + XPutPixel(img,x,y,c); +} + + +POKEIMG_S(img,x,y,c) +XImage *img; +int x,y,c; + +{ + int sx,sy; + + for(sx=0;sx<SCALE;sx++) + for(sy=0;sy<SCALE;sy++) + XPutPixel(img,x*SCALE+sx,y*SCALE+sy,c); +} + + +Plot(x,y,c) +int x,y,c; + +{ + if ((x>=0)&&(x<WINW)&&(y>=0)&&(y<WINH)) + (*POKEIMG)(img,x,y,c); +} + + +Sprite(s,x,y,coll,collcode) +int s,x,y; +CollData *coll; + +{ + int sx,sy; + + if (coll) + coll->no=0; + + for(sy=0;sy<SPRW;sy++) + if (((y+sy)>=0)&&((y+sy)<WINH)) + for(sx=0;sx<SPRW;sx++) + if (spr[s]->data[sy][sx]!=BLACKI) + if (((x+sx)>=0)&&((x+sx)<WINW)) + { + if (coll) + { + if (AT(coll_data,x+sx,y+sy)!=CNONE) + coll->data[coll->no++]=AT(coll_data,x+sx,y+sy); + + AT(coll_data,x+sx,y+sy)=collcode; + } + + (*POKEIMG)(img,x+sx,y+sy,spr[s]->data[sy][sx]); + } +} + + +/* ----------------------------------------------- USER BULLET UTILS +*/ +ClearBullets() +{ + int f; + + bullctr=0; + + for(f=0;f<NOBULL;f++) + ubull[f].inuse=False; +} + + +NewBullet(x,y) +int x,y; + +{ + int f; + + for(f=0;f<NOBULL;f++) + if (!ubull[f].inuse) + { + ubull[f].inuse=True; + ubull[f].x=x; + ubull[f].y=y; + return; + } +} + + +DeleteBullet(f,y) + +{ + ubull[f].inuse=False; +} + + +int BulletsInUse() +{ + int f,c; + + for(f=c=0;f<NOBULL;f++) + if (ubull[f].inuse) + c++; + + return(c); +} + + +int FreeBullets() +{ + return(BulletsInUse()<NOBULL); +} + + +int UpdateBullets() +{ + CollData coll; + int f; + + for(f=0;f<NOBULL;f++) + if (ubull[f].inuse) + { + Sprite(SBULLET,ubull[f].x,ubull[f].y,&coll,CUBULL(f)); + + if ((ubull[f].y+=BULLYI)<-8) + { + ubull[f].inuse=False; + miss++; + } + } +} + + +/* ----------------------------------------------- TITLE SCREEN +*/ +static XFuncControl ProcessTitle(void) + +{ + static unsigned int ctr=0; + static int xi[8]={ 0,-1,-1,-1, 0, 1, 1, 1}; + static int yi[8]={ 1, 1, 0,-1,-1,-1, 0, 1}; + int f,k; + + ctr++; + + Cls(True,xi[(ctr%800)/100],yi[(ctr%800)/100],True); + + Centre(20,YELLOW,"GALAXY INVADERS"); + Centre(12,YELLOW,"________________"); + Centre(22,YELLOW,"________________"); + + if ((ctr/100)%2) + { + Centre(70,RNDCOL,"ALL TIME HEROES"); + for(f=0;f<NOHI;f++) + XIprintf(img,CH(4,95+f*10),WHITE, + "%2d %-3s %8d %5.1f%% %3d", + f+1,hisc[f].name,hisc[f].score, + hisc[f].percent,hisc[f].level); + /* + XIprintf(img,CH(8,85+f*10),WHITE, + "%2d %3s %8d %5.1f%%", + f+1,hisc[f].name,hisc[f].score,hisc[f].percent); + */ + } + else + { + Centre(100,RED," - 10 POINTS"); + Centre(115,RED," - 20 POINTS"); + Centre(130,RED," - 40 POINTS"); + + Sprite(GALAX1,7*8,100,NULL,CNONE); + Sprite(GALAX2,7*8,115,NULL,CNONE); + Sprite(GALAX3,7*8,130,NULL,CNONE); + } + + if ((ctr/10)%2) + Centre(220,WHITE,"PRESS FIRE TO PLAY"); + + DoDebugMenu(); + + Update(); + + k=GetKey(); + + if (k==FIRE) + return(XFUNCSTOP); + else if (k==QUIT) + { + quit=True; + return(XFUNCSTOP); + } + else + return(XFUNCCONT); +} + + +DoDebugMenu(fl) + +{ + static int debug_menu=False; + KeySym k; + int f; + + if ((k=RawKey())=='r') + debug_menu=!debug_menu; + + if (debug_menu) + { + Cls (False,0,0,True); + + for(f=0;f<128;f++) + XIprintf(img,CH((f%20)*8,(f/20)*8),CYAN,"%c",f); + + for(f=0;f<NOSPR;f++) + Sprite(f,f*8,80,NULL,CNONE); + + XIprintf(img,CH(0,TAGLINE-56),CYAN, + "(f) FONT : %5d",FONT); + XIprintf(img,CH(0,TAGLINE-48),CYAN, + "(k) PAUSE==SKIP : %5d",PAUSESKIP); + XIprintf(img,CH(0,TAGLINE-40),CYAN, + "(h) SCORE : %5d",SCORE); + XIprintf(img,CH(0,TAGLINE-32),CYAN, + "(l) LIVES : %5d",NOLIVES); + XIprintf(img,CH(0,TAGLINE-24),CYAN, + "(d) GUN DELAY : %5d",BULLDEL); + XIprintf(img,CH(0,TAGLINE-16),CYAN, + "(m) NO BULLETS : %5d",NOBULL); + XIprintf(img,CH(0,TAGLINE-8),CYAN, + "(s) START LEVEL : %5d",LEVEL); + XIprintf(img,CH(0,TAGLINE),CYAN, + "(%s)",levdata[LEVEL%NOLEV].title); + + XIprintf(img,CH(0,100),CYAN,"(x) SET TO DEFAULTS"); + XIprintf(img,CH(0,108),CYAN,"(o) SET TO DEBUG"); + XIprintf(img,CH(0,116),CYAN,"(w) SET TO SMALLER DEBUG"); + + switch(k) + { + case 'f': + FONT^=1; + XISetFont(FONT); + break; + case 'k': + PAUSESKIP=!PAUSESKIP; + break; + case 'h': + SCORE=hisc[0].score; + break; + case 'l': + if ((++NOLIVES)>10) + NOLIVES=1; + break; + case 'd': + if (BULLDEL==10) + BULLDEL=1; + else + BULLDEL=10; + break; + case 'm': + if (NOBULL==4) + NOBULL=MAXBULL; + else + NOBULL=4; + break; + case 's': + LEVEL++; + break; + case 'x': + SCORE=0; + NOLIVES=3; + BULLDEL=10; + NOBULL=4; + LEVEL=0; + break; + case 'o': + PAUSESKIP=1; + NOLIVES=1; + BULLDEL=1; + NOBULL=MAXBULL; + LEVEL=NOLEV-1; + SCORE=hisc[0].score; + break; + case 'w': + PAUSESKIP=1; + LEVEL=NOLEV-1; + break; + } + } +} + + +/* ----------------------------------------------- START LEVEL +*/ +static XFuncControl ProcessStartLevel(void) +{ + char s[80]; + + Cls(True,levdata[levelndx].sx,levdata[levelndx].sy,True); + + sprintf(s,"LEVEL %d",level+1); + + Centre (50,YELLOW,s); + Centre (100,RED,levdata[levelndx].title); + + Update(); + + if (GetKey()!=NONE) + return(XFUNCSTOP); + + return(XFUNCCONT); +} + + +/* ----------------------------------------------- PLAY LEVEL +*/ +static XFuncControl ProcessGame(void) + +{ + static unsigned int ctr=0; + static int immune=0; + int f,k; + CollData coll; + + ctr++; + + k=GetKey(); + + if (!PAUSESKIP) + if (Paused(k)) + return (XFUNCCONT); + + Cls(True,levdata[levelndx].sx,levdata[levelndx].sy,True); + + if (lives) + for(f=0;f<lives;f++) + Sprite(SHIP,WINW-CHXSPR(f),TAGLINE,NULL,CNONE); + + if ((level+1)/10) + for(f=0;f<(level+1)/10;f++) + Sprite(FLAG10,CHXSPR(f),TAGLINE,NULL,CNONE); + + if ((level+1)%10) + for(f=0;f<(level+1)%10;f++) + Sprite(FLAG1,CHXSPR((level+1)/10+f),TAGLINE,NULL,CNONE); + + XIprintf(img,CH(0,0),YELLOW,"SCORE %d",score); + + if (!dead) + { + if (keymap[LEFT]) + if (shipx>1) + shipx-=2; + + if (keymap[RIGHT]) + if (shipx<WINW-SPRW-1) + shipx+=2; + + if (keymap[FIRE]) + if (bullctr==0) + { + bullctr=BULLDEL; + NewBullet(shipx,BLYINIT); + } + } + + if (bullctr) + bullctr--; + + MoveAliens(); + + UpdateBullets(); + UpdateExplosions(); + DrawAndKillAliens(); + + if (!dead) + { + if (immune) + Sprite(SAFESHIP,shipx,SHIPY,&coll,CSHIP); + else + Sprite(SHIP,shipx,SHIPY,&coll,CSHIP); + + if ((bullctr==0)&&(FreeBullets())) + Sprite(SBULLET,shipx,BLYINIT,NULL,CNONE); + + if (immune) + immune--; + + if ((coll.no)&&(!immune)) + { + dead=True; + + for(f=0;f<5;f++) + { + NewExplosion(shipx+SPRW/2-(SPRW/2*f),SHIPY+SPRH/2,6-f); + NewExplosion(shipx+SPRW/2+(SPRW/2*f),SHIPY+SPRH/2,6-f); + NewExplosion(shipx+SPRW/2,SHIPY+SPRH/2-(SPRH/2*f),6-f); + } + } + } + + Update(); + + if (k==QUIT) + { + score=-1; + lives=0; + return(XFUNCSTOP); + } + + if ((k==PAUSE)&&(PAUSESKIP)) + { + level++; + levelndx=(levelndx+1)%NOLEV; + return(XFUNCSTOP); + } + + if ((dead)&&(no_exp==0)) + { + lives--; + + if (lives==0) + return(XFUNCSTOP); + else + { + shipx=SHXINIT; + dead=False; + immune=100; + } + } + + if ((aliendead)&&(no_exp==0)&&(!dead)) + { + level++; + levelndx=(levelndx+1)%NOLEV; + + if ((levelndx==0)&&(level>1)) + lives++; + + return(XFUNCSTOP); + } + + return(XFUNCCONT); +} + + +/* ----------------------------------------------- PAUSE CODE +*/ +DoPause() +{ + static unsigned int c=0; + + c++; + + if ((c/10)%2) + Centre(WINH/2-4,WHITE,"PAUSED"); + else + Centre(WINH/2-4,YELLOW,"PAUSED"); + + Update(); +} + + +int Paused(k) +int k; + +{ + static int paused=False; + + if (k==PAUSE) + paused=!paused; + + if (paused) + DoPause(); + + return(paused); +} + + +/* ----------------------------------------------- GAME OVER +*/ +static XFuncControl ProcessGameOver(void) +{ + static int posx=32; + static unsigned int ctr=0; + + Cls (True,0,1,True); + + ctr++; + + XIprintf(img,CH(posx,32),YELLOW,"SHOTS FIRED : %6d",hit+miss); + XIprintf(img,CH(posx,48),YELLOW,"HIT : %6d",hit); + XIprintf(img,CH(posx,64),YELLOW,"MISS : %6d",miss); + if (hit+miss) + XIprintf(img,CH(posx,80),YELLOW,"PERCENTAGE : %5.1f", + ((double)hit/(hit+miss))*100.0); + else + XIprintf(img,CH(posx,80),YELLOW,"PERCENTAGE : 0.0"); + + if ((ctr/10)%2) + Centre(120,WHITE,"GAME OVER"); + + Update(); + + if (GetKey()==NONE) + return(XFUNCCONT); + else + return(XFUNCSTOP); +} + + +/* ----------------------------------------------- HI SCORES +*/ +ReadScores() +{ + int fd,f; + + if ((fd=open(HISCFILE,O_RDONLY))==-1) + return; + + for(f=0;f<NOHI;f++) + read(fd,hisc+f,sizeof(HiSc)); + + close(fd); +} + + +WriteScores() +{ + int fd,f; + + if ((fd=open(HISCFILE,O_WRONLY|O_CREAT|O_TRUNC,0777))==-1) + { + fprintf(stderr,"Failed to write hiscores!\n"); + return; + } + + for(f=0;f<NOHI;f++) + write(fd,hisc+f,sizeof(HiSc)); + + close(fd); +} + + +static XFuncControl ProcessHiScore(void) +{ + static char *hisc_let="ABCDEFGHIJKLMNOPQRSTUVWXYZ.\177"; + static char *let; + static int len=0; + static char name[4]; + static int first=True; + static int pos=0; + static int bounce=0; + int f,done=False; + + if (first) + { + len=0; + strcpy(name,""); + let=hisc_let; + bounce=0; + + for(f=NOHI-1;f>-1;f--) + if (hisc[f].score<score) + pos=f; + + if (pos<NOHI-1) + for(f=NOHI-1;f>pos;f--) + hisc[f]=hisc[f-1]; + + strcpy(hisc[pos].name,""); + hisc[pos].score=score; + hisc[pos].level=level+1; + if (hit+miss) + hisc[pos].percent=((double)hit/(hit+miss))*100.0; + else + hisc[pos].percent=0.0; + + first=False; + } + + Cls (True,1,1,True); + + Centre(16,WHITE,"CONGRATULATIONS!"); + Centre(30,YELLOW,"ENTER YOUR INITIALS"); + Centre(40,YELLOW,"FOR THE ALL TIME HEROES"); + + hisc[pos].name[len]=*let; + hisc[pos].name[len+1]=0; + + for(f=0;f<NOHI;f++) + XIprintf(img,CH(4,110+f*10),(f==pos) ? (CYAN) : (RED), + "%2d %-3s %8d %5.1f%% %3d", + f+1,hisc[f].name,hisc[f].score, + hisc[f].percent,hisc[f].level); + + if ((keymap[LEFT])&&(!bounce)) + { + bounce=30; + if (let==hisc_let) + let=hisc_let+strlen(hisc_let)-1; + else + let--; + } + + if ((keymap[RIGHT])&&(!bounce)) + { + bounce=30; + if (!(*++let)) + let=hisc_let; + } + + switch (GetKey()) + { + case FIRE: + len++; + break; + case NONE: + bounce=0; + break; + } + + if (bounce) + bounce--; + + Update(); + + if (len==3) + { + first=True; + return(XFUNCSTOP); + } + else + return(XFUNCCONT); +} + + +/* ----------------------------------------------- PARTICLE EXPLOSION ROUTINES +*/ +ClearExplosions() +{ + int f; + + no_exp=0; + + for(f=0;f<MAXEXP;f++) + exp_fx[f].inuse=0; +} + + +NewExplosion(x,y,w) +int x,y,w; + +{ + int f,r; + + for(f=0;f<MAXEXP;f++) + if (!exp_fx[f].inuse) + { + exp_fx[f].inuse=EXPLIFE*w; + for(r=0;r<EXPPART;r++) + { + exp_fx[f].cx[r]=x+RND(5)-2; + exp_fx[f].cy[r]=y+RND(5)-2; + exp_fx[f].x[r]=RND(5)-2; + exp_fx[f].y[r]=RND(5)-2; + } + no_exp++; + return; + } +} + + +UpdateExplosions() +{ + int f,r; + + for(f=0;f<MAXEXP;f++) + if (exp_fx[f].inuse) + { + for(r=0;r<EXPPART;r++) + Plot(exp_fx[f].cx[r]+=exp_fx[f].x[r], + exp_fx[f].cy[r]+=exp_fx[f].y[r], + CYAN); + + if ((--exp_fx[f].inuse)==0) + no_exp--; + } +} + + +/* ----------------------------------------------- ALIEN DEFINITION AND MOVEMENT +*/ +int alienctr; +int alienyi; +int alienxi; + +InitAlien(f,x,y,t) +int f,x,y,t; + +{ + alien[f].alive=True; + alien[f].type=t; + alien[f].x=x; + alien[f].y=y; + alien[f].shot.inuse=False; +} + + +SinCos(cx,cy,a,rx,ry,x,y) +int cx,cy,a,rx,ry,*x,*y; + +{ + double dx,dy; + + dx=cx+si[a]*rx; + dy=cy+co[a]*ry; + + *x=(int)dx; + *y=(int)dy; +} + + +DefineAliens() +{ + int f,x,y; + + alienctr=0; + + switch(levelndx) + { + case 0: /* CLASSIC */ + no_aliens=0; + + for (x=0;x<10;x++) + for (y=0;y<3;y++) + { + InitAlien(no_aliens,x*16,y*16+50,GALAX3-y); + no_aliens++; + } + + alienxi=1; + + break; + + case 1: /* RUN AWAY */ + no_aliens=0; + + for(f=0;f<20;f++) + { + InitAlien(no_aliens,RND(WINW-SPRW*2)+SPRW,RND(WINH/2)+WINH/4, + GALAX1+RND(3)); + no_aliens++; + } + + break; + + case 2: /* DIZZY */ + no_aliens=0; + + for(y=0;y<3;y++) + for(x=0;x<10;x++) + { + InitAlien(no_aliens,360*x,y*20+20,GALAX3-y); + alien[no_aliens].sx=alien[no_aliens].x; + alien[no_aliens].sy=alien[no_aliens].y; + no_aliens++; + } + + break; + + case 3: /* CARNIVAL */ + no_aliens=0; + + for(f=0;f<WINW/10;f++) + { + InitAlien(no_aliens,f*10,WINH-120,GALAX1+RND(3)); + no_aliens++; + } + + break; + + case 4: /* FLEET WAVE 1 */ + no_aliens=0; + + for(x=0;x<24;x++) + for(y=0;y<3;y++) + { + InitAlien(no_aliens,3+x*9,50+8*y,ALIENUFO); + no_aliens++; + } + + break; + + case 5: /* BOUNCY */ + no_aliens=0; + + for(f=0;f<20;f++) + { + InitAlien(no_aliens,RND(WINW),RND(WINH/2)+WINH/4,GALAX1); + + do + { + alien[no_aliens].sx=RND(3)-1; + } while (alien[no_aliens].sx==0); + + do + { + alien[no_aliens].sy=RND(5)-2; + } while (alien[no_aliens].sy==0); + + no_aliens++; + } + + break; + + case 6: /* THE COLLECTIVE 1 */ + no_aliens=0; + + for(y=0;y<SPRH;y++) + for(x=0;x<SPRW;x++) + if (galax1_1.data[y][x]!=BLACK) + { + InitAlien(no_aliens,0,0,GALAX1); + alien[no_aliens].sx=x; + alien[no_aliens].sy=y; + no_aliens++; + } + else if (galax1_2.data[y][x]!=BLACK) + { + InitAlien(no_aliens,0,0,GALAX1); + alien[no_aliens].sx=x; + alien[no_aliens].sy=y; + no_aliens++; + } + break; + + case 7: /* THE COLLECTIVE 2 */ + no_aliens=0; + + for(y=0;y<SPRH;y++) + for(x=0;x<SPRW;x++) + if (galax2_1.data[y][x]!=BLACK) + { + InitAlien(no_aliens,0,0,GALAX2); + alien[no_aliens].sx=x; + alien[no_aliens].sy=y; + no_aliens++; + } + else if (galax2_2.data[y][x]!=BLACK) + { + InitAlien(no_aliens,0,0,GALAX2); + alien[no_aliens].sx=x; + alien[no_aliens].sy=y; + no_aliens++; + } + break; + + case 8: /* THE COLLECTIVE 2 */ + no_aliens=0; + + for(y=0;y<SPRH;y++) + for(x=0;x<SPRW;x++) + if (galax3_1.data[y][x]!=BLACK) + { + InitAlien(no_aliens,0,0,GALAX3); + alien[no_aliens].sx=x; + alien[no_aliens].sy=y; + no_aliens++; + } + else if (galax3_2.data[y][x]!=BLACK) + { + InitAlien(no_aliens,0,0,GALAX3); + alien[no_aliens].sx=x; + alien[no_aliens].sy=y; + no_aliens++; + } + else if (galax3_3.data[y][x]!=BLACK) + { + InitAlien(no_aliens,0,0,GALAX3); + alien[no_aliens].sx=x; + alien[no_aliens].sy=y; + no_aliens++; + } + break; + + case 9: /* FLEET WAVE 2 */ + no_aliens=0; + + for (y=0;y<3;y++) + for (x=0;x<20;x++) + { + InitAlien(no_aliens,(WINW*x)/20,y*10+WINH/2-10,GALAX3-y); + no_aliens++; + } + + break; + + case 10: /* ALIEN MOTHERBRAIN */ + no_aliens=0; + + x=10; + y=3; + for(f=0;f<44;f++) + { + InitAlien(no_aliens,0,0,ENTITY1); + alien[no_aliens].sx=x; + alien[no_aliens].sy=y; + + no_aliens++; + + x+=y; + + if ((x<10)||(x>WINW/3)) + { + y=-y; + x+=y; + } + } + break; + + default: + printf("undefined level %d?\n",levelndx); + exit(1); + } +} + + +MoveAliens() +{ + int f,x,y; + int flag=False; + + alienctr++; + + switch(levelndx) + { + case 0: /* CLASSIC */ + for (f=0;f<no_aliens;f++) + if (alien[f].alive) + { + alien[f].x+=alienxi; + + if ((alien[f].x<1)||(alien[f].x>WINW-SPRW-1)) + flag=True; + } + + if (flag) + { + alienxi=-alienxi; + + for (f=0;f<no_aliens;f++) + if (alien[f].alive) + if ((alien[f].y+=4)>WINH) + alien[f].y-=WINH; + } + + break; + + case 1: /* RUN AWAY */ + for (f=0;f<no_aliens;f++) + if (alien[f].alive) + if ((alien[f].y-=1)<=-SPRH) + alien[f].y+=WINH+SPRH; + + break; + + case 2: /* DIZZY */ + for(y=f=0;y<3;y++) + for(x=0;x<10;x++,f++) + if (alien[f].alive) + { + if (y%2) + { + if ((alien[f].sx+=10)>3599) + alien[f].sx-=3600; + } + else + { + if ((alien[f].sx-=10)<0) + alien[f].sx+=3600; + } + + SinCos(WINW/2,WINH/2,alien[f].sx,alien[f].sy*2, + alien[f].sy/2,&alien[f].x,&alien[f].y); + } + + break; + + case 3: /* CARNIVAL */ + for(f=0;f<no_aliens;f++) + if (alien[f].alive) + if ((alien[f].x+=(y+1))>=WINW) + alien[f].x-=WINW+SPRW; + + break; + + case 4: /* FLEET WAVE 1 */ + break; + + case 5: /* BOUNCY */ + for(f=0;f<no_aliens;f++) + if (alien[f].alive) + { + alien[f].x+=alien[f].sx; + if ((alien[f].x<=0)||(alien[f].x>=WINW)) + alien[f].sx=-alien[f].sx; + + alien[f].y+=alien[f].sy; + if ((alien[f].y<=0)||(alien[f].y>=SHIPY)) + alien[f].sy=-alien[f].sy; + } + break; + + case 6: /* THE COLLECTIVE 1 */ + for(f=0;f<no_aliens;f++) + if (alien[f].alive) + if (spr[GALAX1]->data[alien[f].sy][alien[f].sx]!=BLACK) + { + alien[f].x=WINW/2-(SPRW+2)*4+alien[f].sx*(SPRW+2); + alien[f].y=WINH/2-(SPRH+2)*4+alien[f].sy*(SPRH+2); + } + else + { + alien[f].x=-100; + alien[f].y=SHIPY; + } + + break; + + case 7: /* THE COLLECTIVE 2 */ + for(f=0;f<no_aliens;f++) + if (alien[f].alive) + if (spr[GALAX2]->data[alien[f].sy][alien[f].sx]!=BLACK) + { + alien[f].x=WINW/2-(SPRW+2)*4+alien[f].sx*(SPRW+2); + alien[f].y=WINH/2-(SPRH+2)*4+alien[f].sy*(SPRH+2); + } + else + { + alien[f].x=-100; + alien[f].y=SHIPY; + } + + break; + + case 8: /* THE COLLECTIVE 3 */ + for(f=0;f<no_aliens;f++) + if (alien[f].alive) + if (spr[GALAX3]->data[alien[f].sy][alien[f].sx]!=BLACK) + { + alien[f].x=WINW/2-(SPRW+2)*4+alien[f].sx*(SPRW+2); + alien[f].y=WINH/2-(SPRH+2)*4+alien[f].sy*(SPRH+2); + } + else + { + alien[f].x=-100; + alien[f].y=SHIPY; + } + + break; + + case 9: /* FLEET WAVE 2 */ + for(y=f=0;y<3;y++) + for(x=0;x<20;x++,f++) + if (alien[f].alive) + if (y%2) + { + if ((alien[f].x+=(y+1))>=WINW) + alien[f].x-=WINW+SPRW; + } + else + { + if ((alien[f].x-=(y+1))<=-SPRW) + alien[f].x+=WINW+SPRW; + } + + break; + + case 10: /* ALIEN MOTHERBRAIN */ + for(f=0;f<44;f++) + if (alien[f].alive) + { + SinCos(WINW/2,WINH/2,f*81,alien[f].sx, + alien[f].sx,&alien[f].x,&alien[f].y); + + alien[f].sx+=alien[f].sy; + + if ((alien[f].sx<10)||(alien[f].sx>WINW/3)) + { + alien[f].sy=-alien[f].sy; + alien[f].sx+=alien[f].sy; + } + } + break; + + default: + printf("undefined level %d?\n",levelndx); + exit(1); + } +} + + +CheckAlienShot(a) +Alien *a; + +{ + if ((levdata[levelndx].shot_type==NOSHOT)||(dead)) + return; + + if (a->shot.inuse) + return; + + if (RND(200)<(1+level)) + { + a->shot.inuse=True; + + a->shot.x=ITOF(a->x); + a->shot.y=a->y+SPRH; + + switch (levdata[levelndx].shot_type) + { + case VISHOT: + a->shot.yi=4+RND(4); + break; + default: + a->shot.yi=3; + break; + } + + switch (levdata[levelndx].shot_type) + { + case SISHOT: + a->shot.xi=0; + break; + + case VISHOT: + if (shipx<a->x) + a->shot.xi=-16*a->shot.yi; + else if (shipx<a->x) + a->shot.xi=16*a->shot.yi; + else + a->shot.xi=0; + break; + + case GASHOT: + if (shipx<a->x) + a->shot.xi=-64; + else if (shipx>a->x) + a->shot.xi=64; + else + a->shot.xi=0; + break; + + default: + a->shot.xi=0; + break; + } + } +} + + +DrawAndKillAliens() + +{ + CollData coll; + int f,r; + + aliendead=True; + + for(f=0;f<no_aliens;f++) + { + if (alien[f].alive) + { + aliendead=False; + + CheckAlienShot(&alien[f]); + + Sprite(alien[f].type,alien[f].x,alien[f].y,&coll,CALIEN); + + if (BulletsInUse()) + if (coll.no) + for(r=0;r<coll.no;r++) + if (coll.data[r]&CUBULLM) + { + NewExplosion(alien[f].x+SPRW/2,alien[f].y+SPRH/2,1); + + alien[f].alive=False; + + switch(alien[f].type) + { + case GALAX1: + score+=10; + break; + case GALAX2: + score+=20; + break; + case GALAX3: + score+=40; + break; + case ALIENUFO: + case ENTITY1: + score+=50; + break; + } + + DeleteBullet(coll.data[r]-CUBULLM); + hit++; + r=coll.no+1; + } + } + + if (alien[f].shot.inuse) + { + aliendead=False; + + alien[f].shot.x+=alien[f].shot.xi; + alien[f].shot.y+=alien[f].shot.yi; + + if (alien[f].shot.y>WINH) + alien[f].shot.inuse=False; + else + Sprite(ABULLET,FTOI(alien[f].shot.x),alien[f].shot.y, + &coll,CABULL); + } + } +} @@ -0,0 +1,27 @@ +#define icon_width 48 +#define icon_height 48 +static unsigned char icon_bits[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x07, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xf8, + 0x13, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x7e, 0x0e, 0x3e, 0xff, 0xff, + 0x63, 0x3c, 0x0e, 0x3c, 0xff, 0xff, 0xe3, 0x18, 0xcf, 0x24, 0xf8, 0xff, + 0xe3, 0x81, 0xcf, 0x24, 0xf8, 0xff, 0xe3, 0xc3, 0x0f, 0x3e, 0xff, 0xff, + 0xe3, 0xc3, 0x0f, 0x26, 0xff, 0xff, 0xe3, 0x81, 0xcf, 0x24, 0xff, 0xff, + 0xe3, 0x18, 0xcf, 0x24, 0xff, 0xff, 0x63, 0x3c, 0x0e, 0x24, 0xf0, 0xff, + 0x63, 0x7e, 0x0e, 0x66, 0xf0, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0x0f, 0x00, 0xf0, 0xff, + 0xe3, 0xdd, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xd5, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xdd, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x15, 0xeb, 0xac, 0xed, 0xff, + 0xe3, 0xd5, 0x52, 0x4b, 0xed, 0xff, 0xe3, 0xd5, 0xfa, 0xe8, 0xed, 0xff, + 0xe3, 0xd5, 0x7a, 0xeb, 0xe3, 0xff, 0xe3, 0x15, 0xfb, 0xe8, 0xef, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xed, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xf3, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; diff --git a/sprdef.h b/sprdef.h new file mode 100644 index 0000000..2e8df28 --- /dev/null +++ b/sprdef.h @@ -0,0 +1,517 @@ + +#define b 0 +#define W 1 +#define R 2 +#define G 3 +#define B 4 +#define Y 5 +#define C 6 +#define M 7 + +SpriteDef shipspr1_1= + {{ /* SHIP */ + {b,b,b,B,B,b,b,b,}, + {b,b,B,B,B,B,b,b,}, + {b,b,B,W,W,B,b,b,}, + {b,b,b,B,B,b,b,b,}, + {b,Y,b,B,B,b,Y,b,}, + {b,R,B,B,B,B,R,b,}, + {b,R,B,B,B,B,R,b,}, + {b,R,b,B,B,b,R,b,}, + }}; + +SpriteDef shipspr1_2= + {{ /* SHIP */ + {b,b,b,B,B,b,b,b,}, + {b,b,B,B,B,B,b,b,}, + {b,b,B,W,W,B,b,b,}, + {b,b,b,B,B,b,b,b,}, + {b,R,b,B,B,b,R,b,}, + {b,Y,B,B,B,B,Y,b,}, + {b,R,B,B,B,B,R,b,}, + {b,R,b,B,B,b,R,b,}, + }}; + +SpriteDef shipspr1_3= + {{ /* SHIP */ + {b,b,b,B,B,b,b,b,}, + {b,b,B,B,B,B,b,b,}, + {b,b,B,W,W,B,b,b,}, + {b,b,b,B,B,b,b,b,}, + {b,R,b,B,B,b,R,b,}, + {b,R,B,B,B,B,R,b,}, + {b,Y,B,B,B,B,Y,b,}, + {b,R,b,B,B,b,R,b,}, + }}; + +SpriteDef shipspr1_4= + {{ /* SHIP */ + {b,b,b,B,B,b,b,b,}, + {b,b,B,B,B,B,b,b,}, + {b,b,B,W,W,B,b,b,}, + {b,b,b,B,B,b,b,b,}, + {b,R,b,B,B,b,R,b,}, + {b,R,B,B,B,B,R,b,}, + {b,R,B,B,B,B,R,b,}, + {b,Y,b,B,B,b,Y,b,}, + }}; + +SpriteDef alienbullet1= + {{ /* ALIEN BULLET */ + {b,b,b,W,W,b,b,b,}, + {b,b,b,W,W,b,b,b,}, + {b,b,b,W,W,b,b,b,}, + {b,b,b,b,b,b,b,b,}, + {b,b,b,b,b,b,b,b,}, + {b,b,b,b,b,b,b,b,}, + {b,b,b,b,b,b,b,b,}, + {b,b,b,b,b,b,b,b,}, + }}; + +SpriteDef shipbullet1= + {{ /* SHIP BULLET */ + {b,b,b,b,b,b,b,b,}, + {b,b,b,b,b,b,b,b,}, + {b,b,b,b,b,b,b,b,}, + {b,b,b,b,b,b,b,b,}, + {b,b,b,b,b,b,b,b,}, + {b,b,b,C,C,b,b,b,}, + {b,b,b,C,C,b,b,b,}, + {b,b,b,C,C,b,b,b,}, + }}; + +SpriteDef galax1_1= + {{ /* GALAX 1 */ + {b,G,b,b,b,b,G,b,}, + {b,G,b,b,b,b,G,b,}, + {b,b,G,G,G,G,b,b,}, + {b,G,b,G,G,b,G,b,}, + {b,G,G,G,G,G,G,b,}, + {G,b,G,b,b,G,b,G,}, + {G,b,b,G,G,b,b,G,}, + {b,b,b,G,G,b,b,b,}, + }}; + +SpriteDef galax1_2= + {{ /* GALAX 1 */ + {G,b,b,b,b,b,b,G,}, + {b,G,b,b,b,b,G,b,}, + {b,b,G,G,G,G,b,b,}, + {b,G,b,G,G,b,G,b,}, + {b,G,G,G,G,G,G,b,}, + {G,b,G,b,b,G,b,G,}, + {b,G,b,G,G,b,G,b,}, + {b,b,G,b,b,G,b,b,}, + }}; + +SpriteDef galax2_1= + {{ /* GALAX 2 */ + {b,b,b,M,M,b,b,b,}, + {b,b,M,M,M,M,b,b,}, + {b,M,b,M,M,b,M,b,}, + {b,M,M,M,M,M,M,b,}, + {b,M,M,M,M,M,M,b,}, + {M,b,M,M,M,M,b,M,}, + {M,b,b,M,M,b,b,M,}, + {M,b,b,M,M,b,b,M,}, + }}; + +SpriteDef galax2_2= + {{ /* GALAX 2 */ + {b,b,b,M,M,b,b,b,}, + {b,b,M,M,M,M,b,b,}, + {b,M,b,M,M,b,M,b,}, + {b,M,M,M,M,M,M,b,}, + {M,M,M,b,b,M,M,M,}, + {M,b,M,M,M,M,b,M,}, + {M,b,b,M,M,b,b,M,}, + {b,b,M,b,b,M,b,b,}, + }}; + +SpriteDef galax3_1= + {{ /* GALAX 3 */ + {R,b,b,b,b,b,b,R,}, + {R,b,b,B,B,b,b,R,}, + {R,R,b,B,B,b,R,R,}, + {R,R,R,b,b,R,R,R,}, + {R,b,R,R,R,R,b,R,}, + {R,b,b,R,R,b,b,R,}, + {b,b,R,R,R,R,b,b,}, + {b,b,b,R,R,b,b,b,}, + }}; + +SpriteDef galax3_2= + {{ /* GALAX 3 */ + {b,b,b,b,b,b,b,b,}, + {R,b,b,B,B,b,b,R,}, + {R,b,b,B,B,b,b,R,}, + {R,R,R,b,b,R,R,R,}, + {R,R,R,R,R,R,R,R,}, + {R,b,b,R,R,b,b,R,}, + {R,b,R,R,R,R,b,R,}, + {b,b,b,R,R,b,b,b,}, + }}; + +SpriteDef galax3_3= + {{ /* GALAX 3 */ + {b,b,b,b,b,b,b,b,}, + {b,b,b,B,B,b,b,b,}, + {R,b,b,B,B,b,b,R,}, + {R,b,R,b,b,R,b,R,}, + {R,R,R,R,R,R,R,R,}, + {R,R,b,R,R,b,R,R,}, + {R,b,R,R,R,R,b,R,}, + {R,b,b,R,R,b,b,R,}, + }}; + +SpriteDef galax3_4= + {{ /* GALAX 3 */ + {b,b,b,b,b,b,b,b,}, + {R,b,b,B,B,b,b,R,}, + {R,b,b,B,B,b,b,R,}, + {R,R,R,b,b,R,R,R,}, + {R,R,R,R,R,R,R,R,}, + {R,b,b,R,R,b,b,R,}, + {R,b,R,R,R,R,b,R,}, + {b,b,b,R,R,b,b,b,}, + }}; + +SpriteDef flag1= + {{ /* FLAG1 */ + {b,b,b,b,b,b,b,b,}, + {b,b,b,b,b,b,b,b,}, + {b,b,W,R,R,b,b,b,}, + {b,b,W,R,R,R,b,b,}, + {b,b,W,R,R,b,b,b,}, + {b,b,W,b,b,b,b,b,}, + {b,b,W,b,b,b,b,b,}, + {b,b,W,b,b,b,b,b,}, + }}; + +SpriteDef flag10= + {{ /* FLAG10 */ + {W,W,R,R,b,b,b,b,}, + {W,W,R,R,R,R,b,b,}, + {W,W,R,R,R,R,R,R,}, + {W,W,R,R,R,R,b,b,}, + {W,W,R,R,b,b,b,b,}, + {W,W,b,b,b,b,b,b,}, + {W,W,b,b,b,b,b,b,}, + {W,W,b,b,b,b,b,b,}, + }}; + +SpriteDef entity1_1= + {{ /* ENTITY1 */ + {b,G,G,G,G,G,G,b,}, + {G,G,G,G,G,G,G,G,}, + {G,G,G,G,G,G,G,G,}, + {G,G,G,W,W,G,G,G,}, + {G,G,G,W,W,G,G,G,}, + {G,G,G,G,G,G,G,G,}, + {G,G,G,G,G,G,G,G,}, + {b,G,G,G,G,G,G,b,}, + }}; + +SpriteDef entity1_2= + {{ /* ENTITY1 */ + {b,b,G,G,G,G,b,b,}, + {b,G,G,G,G,G,G,b,}, + {G,G,G,W,W,G,G,G,}, + {G,G,W,W,W,W,G,G,}, + {G,G,W,W,W,W,G,G,}, + {G,G,G,W,W,G,G,G,}, + {b,G,G,G,G,G,G,b,}, + {b,b,G,G,G,G,b,b,}, + }}; + +SpriteDef entity1_3= + {{ /* ENTITY1 */ + {b,b,b,b,b,b,b,b,}, + {b,b,G,W,W,G,b,b,}, + {b,G,W,W,W,W,G,b,}, + {b,W,W,W,W,W,W,b,}, + {b,W,W,W,W,W,W,b,}, + {b,G,W,W,W,W,G,b,}, + {b,b,G,W,W,G,b,b,}, + {b,b,b,b,b,b,b,b,}, + }}; + +SpriteDef entity1_4= + {{ /* ENTITY1 */ + {b,b,G,G,G,G,b,b,}, + {b,G,G,G,G,G,G,b,}, + {G,G,G,W,W,G,G,G,}, + {G,G,W,W,W,W,G,G,}, + {G,G,W,W,W,W,G,G,}, + {G,G,G,W,W,G,G,G,}, + {b,G,G,G,G,G,G,b,}, + {b,b,G,G,G,G,b,b,}, + }}; + +SpriteDef alienufo1_1= + {{ /* ALIENUFO */ + {b,b,b,b,b,b,b,b,}, + {b,b,b,R,R,b,b,b,}, + {b,R,R,R,R,R,R,b,}, + {R,R,R,R,R,R,R,R,}, + {Y,Y,B,B,B,B,B,B,}, + {R,R,R,R,R,R,R,R,}, + {b,R,R,R,R,R,R,b,}, + {b,b,b,R,R,b,b,b,}, + }}; + +SpriteDef alienufo1_2= + {{ /* ALIENUFO */ + {b,b,b,b,b,b,b,b,}, + {b,b,b,R,R,b,b,b,}, + {b,R,R,R,R,R,R,b,}, + {R,R,R,R,R,R,R,R,}, + {B,B,Y,Y,B,B,B,B,}, + {R,R,R,R,R,R,R,R,}, + {b,R,R,R,R,R,R,b,}, + {b,b,b,R,R,b,b,b,}, + }}; + +SpriteDef alienufo1_3= + {{ /* ALIENUFO */ + {b,b,b,b,b,b,b,b,}, + {b,b,b,R,R,b,b,b,}, + {b,R,R,R,R,R,R,b,}, + {R,R,R,R,R,R,R,R,}, + {B,B,B,B,Y,Y,B,B,}, + {R,R,R,R,R,R,R,R,}, + {b,R,R,R,R,R,R,b,}, + {b,b,b,R,R,b,b,b,}, + }}; + +SpriteDef alienufo1_4= + {{ /* ALIENUFO */ + {b,b,b,b,b,b,b,b,}, + {b,b,b,R,R,b,b,b,}, + {b,R,R,R,R,R,R,b,}, + {R,R,R,R,R,R,R,R,}, + {B,B,B,B,B,B,Y,Y,}, + {R,R,R,R,R,R,R,R,}, + {b,R,R,R,R,R,R,b,}, + {b,b,b,R,R,b,b,b,}, + }}; + +SpriteDef safeshipspr1_1= + {{ /* SAFESHIP */ + {b,b,b,W,W,b,b,b,}, + {b,b,W,W,W,W,b,b,}, + {b,b,W,W,W,W,b,b,}, + {b,b,b,W,W,b,b,b,}, + {b,W,b,W,W,b,W,b,}, + {b,W,W,W,W,W,W,b,}, + {b,W,W,W,W,W,W,b,}, + {b,W,b,W,W,b,W,b,}, + }}; + +SpriteDef safeshipspr1_2= + {{ /* SAFESHIP */ + {b,b,b,R,R,b,b,b,}, + {b,b,R,R,R,R,b,b,}, + {b,b,R,R,R,R,b,b,}, + {b,b,b,R,R,b,b,b,}, + {b,R,b,R,R,b,R,b,}, + {b,R,R,R,R,R,R,b,}, + {b,R,R,R,R,R,R,b,}, + {b,R,b,R,R,b,R,b,}, + }}; + + +#undef b +#undef W +#undef R +#undef G +#undef B +#undef Y +#undef C +#undef M + + + + +SpriteAnim anim[NOSPR]= + { + { /* SHIP */ + 4, + { + &shipspr1_1, + &shipspr1_2, + &shipspr1_3, + &shipspr1_4, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + { /* ALIEN BULLET */ + 1, + { + &alienbullet1, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + { /* SHIP BULLET */ + 1, + { + &shipbullet1, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + { /* GALAX1 */ + 2, + { + &galax1_1, + &galax1_2, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + { /* GALAX2 */ + 2, + { + &galax2_1, + &galax2_2, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + { /* GALAX3 */ + 4, + { + &galax3_1, + &galax3_2, + &galax3_3, + &galax3_4, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + { /* FLAG1 */ + 1, + { + &flag1, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + { /* FLAG10 */ + 1, + { + &flag10, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + { /* ENTITY1 */ + 4, + { + &entity1_1, + &entity1_2, + &entity1_3, + &entity1_4, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + { /* ALIENUFO */ + 4, + { + &alienufo1_1, + &alienufo1_2, + &alienufo1_3, + &alienufo1_4, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + { /* SAFESHIP */ + 2, + { + &safeshipspr1_1, + &safeshipspr1_2, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } + }, + }; + +SpriteDef *spr[NOSPR]= + { + &shipspr1_1, + &alienbullet1, + &shipbullet1, + &galax1_1, + &galax2_1, + &galax3_1, + &flag1, + &flag10, + &entity1_1, + &safeshipspr1_1, + }; |