#define StackX (short) *(stack+(stackptr<<1)) #define StackY (short) *(stack+(stackptr<<1)+1) /* MAZETEST (xpos,ypos,mazewidth,pointer to buffer) */ #ifdef BITMAP #define MAZETEST(a,b,c,d) (*((d)+((short)(b)*(short)((c)>>3))+((a)>>3)) & 0x80 >> ((a) & 7)) #else #define MAZETEST(a,b,c,d) (*(d)+(a)+((b)*(c)))) #endif /* MAZESET (xpos,ypos,mazewidth,pointer to buffer */ #ifdef BITMAP #define MAZESET(a,b,c,d) *((d)+((short)(b)*(short)((c)>>3))+((a)>>3))|= 0x80 >> ((a) & 7) #else #define MAZESET(a,b,c,d) *((d)+(a)+((b)*(c)))=1 #endif long seed; /* FastRand() stuff */ short testpoint[4][2]= {{-1,0},{1,0},{0,1},{0,-1}}; /* = left,right,down,up */ short stackptr,direction,newpos(),maze(); long *vposr = (long*)0xdff004; /* Beam position */ short maze(width,height,area) register short width; register char *area; short height; { register short x,y; register short *stack; short i,j; seed=*vposr; /* new Seed for FastRand() */ x=2; /* starting position */ y=(FastRand(seed) % (height-4) + 2) & 0xfffe; /* we need a 'stack' to store those positions, from where we can */ /* continue if we get into a dead end */ if(!(stack=(short*) AllocMem(width*height,NULL))) return(NULL); stackptr=1; StackX=x;StackY=y; j= width & 1 ? width-1:width-2; for(i=0;i