#include #include #include #include /* mem... */ #include #include "cltr.h" extern int planes,columns_vdi; #define WIDTH 6 #define HEIGHT 16 #define FIRSTLINE 4 #define XHEIGHT (HEIGHT+FIRSTLINE+1) #define XWIDTH (WIDTH+2) static int BLOCK_SW = 24; static int BLOCK_W = 20; static int BLOCK_H = 20; static int BLOCK_XW; static int BLOCK_XH; int feld[HEIGHT+5][WIDTH+2]; void get_columns_size(int *w,int *h) { *w=WIDTH*BLOCK_W; *h=HEIGHT*BLOCK_H; } void get_columns_prev(int *w,int *h) { *w=BLOCK_W*2; *h=BLOCK_H*4; } char col_quick1[]={ 0x00,0x00,0x00,0x07,0xff,0xfe,0x07,0xff,0xfe,0x07,0xff,0xfe, 0x07,0xff,0xfe,0x07,0xff,0xfe,0x07,0xff,0xfe,0x00,0x00,0x00, 0x07,0xff,0xfe,0x07,0xff,0xfe,0x07,0xff,0xfe,0x07,0xff,0xfe,0x07,0xff,0xfe,0x00, 0x00,0x00,0x00,0x08,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x01, 0x08,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x01,0x00,0x00,0x00, 0x08,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x01,0x00, 0x00,0x00,0x00,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0b,0x11,0x15,0x0b,0x55,0x55, 0x0b,0x55,0x55,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0xdf,0xdd,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0a,0x00,0x05,0x0a,0xaa,0xad, 0x0a,0x88,0x8d,0x0a,0xaa,0xad,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0x8f,0x8d,0x0b,0x8f,0x8d,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0a,0x44,0x45,0x0b,0x55,0x55, 0x0b,0x55,0x55,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0x8f,0x8d,0x0b,0x07,0x05,0x0b,0x07,0x05,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0a,0x00,0x05,0x0a,0xaa,0xad, 0x0a,0x22,0x25,0x0a,0xaa,0xad,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xdf,0xdd,0x0b,0x8f,0x8d,0x0b,0x07,0x05,0x0a,0x02,0x01,0x0a,0x02,0x01,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0b,0x11,0x15,0x0b,0x55,0x55, 0x0b,0x55,0x55,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0x8f,0x8d,0x0b,0x07,0x05,0x0b,0x07,0x05,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0a,0x00,0x05,0x0a,0xaa,0xad, 0x0a,0x88,0x8d,0x0a,0xaa,0xad,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0x8f,0x8d,0x0b,0x8f,0x8d,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0a,0x44,0x45,0x0b,0x55,0x55, 0x0b,0x55,0x55,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0xdf,0xdd,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0a,0x00,0x05,0x0a,0xaa,0xad, 0x0a,0x22,0x25,0x0a,0xaa,0xad,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0b,0x11,0x15,0x0b,0x55,0x55, 0x0b,0x55,0x55,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0xdf,0xdd,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0a,0x00,0x05,0x0a,0xaa,0xad, 0x0a,0x88,0x8d,0x0a,0xaa,0xad,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0x8f,0x8d,0x0b,0x8f,0x8d,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0a,0x44,0x45,0x0b,0x55,0x55, 0x0b,0x55,0x55,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0x8f,0x8d,0x0b,0x07,0x05,0x0b,0x07,0x05,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0a,0x00,0x05,0x0a,0xaa,0xad, 0x0a,0x22,0x25,0x0a,0xaa,0xad,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xdf,0xdd,0x0b,0x8f,0x8d,0x0b,0x07,0x05,0x0a,0x02,0x01,0x0a,0x02,0x01,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0b,0x11,0x15,0x0b,0x55,0x55, 0x0b,0x55,0x55,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0x8f,0x8d,0x0b,0x07,0x05,0x0b,0x07,0x05,0x00, 0x00,0x00,0x00,0x0a,0x00,0x05,0x0a,0x00,0x05,0x0a,0xaa,0xad, 0x0a,0x88,0x8d,0x0a,0xaa,0xad,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0x8f,0x8d,0x0b,0x8f,0x8d,0x00, 0x00,0x00,0x00,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x00,0x00,0x00, 0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xff,0xfd,0x0b,0xdf,0xdd,0x0b,0xdf,0xdd,0x00, 0x00,0x00,0x00,0x08,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x01, 0x08,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x01,0x00,0x00,0x00, 0x08,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x01,0x08,0x00,0x01,0x00, 0x00,0x00,0x00,0x07,0xff,0xfe,0x07,0xff,0xfe,0x07,0xff,0xfe, 0x07,0xff,0xfe,0x07,0xff,0xfe,0x07,0xff,0xfe,0x00,0x00,0x00, 0x07,0xff,0xfe,0x07,0xff,0xfe,0x07,0xff,0xfe,0x07,0xff,0xfe,0x07,0xff,0xfe,0x00, }; char col_quick2[]={ 0x00,0x00,0x00,0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x7f,0xff,0xe0, 0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x00,0x00,0x00, 0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x00, 0x00,0x00,0x00,0x80,0x00,0x10,0x80,0x00,0x10,0x80,0x00,0x10, 0x80,0x00,0x10,0x80,0x00,0x10,0x80,0x00,0x10,0x00,0x00,0x00, 0x80,0x00,0x10,0x80,0x00,0x10,0x80,0x00,0x10,0x80,0x00,0x10,0x80,0x00,0x10,0x00, 0x00,0x00,0x00,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xb1,0x11,0x50,0xb5,0x55,0x50, 0xb5,0x55,0x50,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xbd,0xfd,0xd0,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xa0,0x00,0x50,0xaa,0xaa,0xd0, 0xa8,0x88,0xd0,0xaa,0xaa,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xb8,0xf8,0xd0,0xb8,0xf8,0xd0,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xa4,0x44,0x50,0xb5,0x55,0x50, 0xb5,0x55,0x50,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xb8,0xf8,0xd0,0xb0,0x70,0x50,0xb0,0x70,0x50,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xa0,0x00,0x50,0xaa,0xaa,0xd0, 0xa2,0x22,0x50,0xaa,0xaa,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbd,0xfd,0xd0,0xb8,0xf8,0xd0,0xb0,0x70,0x50,0xa0,0x20,0x10,0xa0,0x20,0x10,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xb1,0x11,0x50,0xb5,0x55,0x50, 0xb5,0x55,0x50,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xb8,0xf8,0xd0,0xb0,0x70,0x50,0xb0,0x70,0x50,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xa0,0x00,0x50,0xaa,0xaa,0xd0, 0xa8,0x88,0xd0,0xaa,0xaa,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xb8,0xf8,0xd0,0xb8,0xf8,0xd0,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xa4,0x44,0x50,0xb5,0x55,0x50, 0xb5,0x55,0x50,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xbd,0xfd,0xd0,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xa0,0x00,0x50,0xaa,0xaa,0xd0, 0xa2,0x22,0x50,0xaa,0xaa,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xb1,0x11,0x50,0xb5,0x55,0x50, 0xb5,0x55,0x50,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xbd,0xfd,0xd0,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xa0,0x00,0x50,0xaa,0xaa,0xd0, 0xa8,0x88,0xd0,0xaa,0xaa,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xb8,0xf8,0xd0,0xb8,0xf8,0xd0,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xa4,0x44,0x50,0xb5,0x55,0x50, 0xb5,0x55,0x50,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xb8,0xf8,0xd0,0xb0,0x70,0x50,0xb0,0x70,0x50,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xa0,0x00,0x50,0xaa,0xaa,0xd0, 0xa2,0x22,0x50,0xaa,0xaa,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbd,0xfd,0xd0,0xb8,0xf8,0xd0,0xb0,0x70,0x50,0xa0,0x20,0x10,0xa0,0x20,0x10,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xb1,0x11,0x50,0xb5,0x55,0x50, 0xb5,0x55,0x50,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xb8,0xf8,0xd0,0xb0,0x70,0x50,0xb0,0x70,0x50,0x00, 0x00,0x00,0x00,0xa0,0x00,0x50,0xa0,0x00,0x50,0xaa,0xaa,0xd0, 0xa8,0x88,0xd0,0xaa,0xaa,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xb8,0xf8,0xd0,0xb8,0xf8,0xd0,0x00, 0x00,0x00,0x00,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0x00,0x00,0x00, 0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbf,0xff,0xd0,0xbd,0xfd,0xd0,0xbd,0xfd,0xd0,0x00, 0x00,0x00,0x00,0x80,0x00,0x10,0x80,0x00,0x10,0x80,0x00,0x10, 0x80,0x00,0x10,0x80,0x00,0x10,0x80,0x00,0x10,0x00,0x00,0x00, 0x80,0x00,0x10,0x80,0x00,0x10,0x80,0x00,0x10,0x80,0x00,0x10,0x80,0x00,0x10,0x00, 0x00,0x00,0x00,0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x7f,0xff,0xe0, 0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x00,0x00,0x00, 0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x7f,0xff,0xe0,0x00, }; MFDB cbloecke={col_quick2,20*16,20,20,0,1,0,0,0}; typedef struct { int x; int y; int c[3]; } STONE; static STONE stone,next; extern long screen_addr,buffer_addr; extern MFDB buffer; extern int screen_width; extern dr_columns1(char *dest,char *source); extern dr_columns2(char *dest,char *source); static int x_pos[XWIDTH]; static int y_pos[XHEIGHT]; static void (*dr_block)(int x,int y,int col); static void qdr_block(int x,int y,int col) { int xx,yy; char *source,*dest; xx=x_pos[x]; yy=y_pos[y]; dest=(char*)buffer_addr+(long)yy*buffer_width+xx/8; if ( xx&7 ) { source=col_quick1+col*3; dr_columns1(dest,source); } else { source=col_quick2+col*3; dr_columns2(dest,source); } if ( yycopy_max ) copy_max=yy+BLOCK_XH; } static void vdidr_block(int x,int y,int col) { int xy[8],yy; xy[0]=col*BLOCK_SW; /* bl”cke auf bytegrenze verbreitert */ xy[1]=0; xy[2]=xy[0]+BLOCK_XW; xy[3]=BLOCK_XH; xy[4]=x_pos[x]; yy=xy[5]=y_pos[y]; xy[6]=xy[4]+BLOCK_XW; xy[7]=xy[5]+BLOCK_XH; vro_cpyfm(handle,S_ONLY,xy,&cbloecke,&buffer); if ( yycopy_max ) copy_max=yy+BLOCK_XH; } static void dr_vdi(int x,int y,int col,int x_off,int y_off) { int xy[8]; xy[0]=col*BLOCK_SW; /* bl”cke auf bytegrenze verbreitert */ xy[1]=0; xy[2]=xy[0]+BLOCK_XW; xy[3]=BLOCK_XH; xy[4]=x_pos[x]+x_off; xy[5]=y_pos[y]+y_off; xy[6]=xy[4]+BLOCK_XW; xy[7]=xy[5]+BLOCK_XH; vro_cpyfm(handle,S_ONLY,xy,&cbloecke,&screen); } static void rm_stone(void) { int i,y; for ( i=0; i<3; i++ ) { y=stone.y+i; if ( y>=FIRSTLINE ) { dr_block(stone.x,y,0); } } } static void dr_stone(void) { int i,y; for ( i=0; i<3; i++ ) { y=stone.y+i; if ( y>=FIRSTLINE ) { dr_block(stone.x,y,stone.c[i]); } } } /*------------------------------------------------------------------------------ preview ------------------------------------------------------------------------------*/ static void do_draw(void *data,int x,int y,int w,int h) { int i; for ( i=0; i<3; i++ ) dr_vdi(1,FIRSTLINE+i,next.c[i],prev_x+(prev_w-BLOCK_W)/2,prev_y+(prev_h-BLOCK_H*3)/2); } static void dr_preview(void) { draw_preview(do_draw,0l); } void dr_cstat(int x,int y,int dy) { int i; for ( i=1; i<7; i++,y+=dy ) dr_vdi(2,FIRSTLINE,i,x,y); } static void init_feld(void) { int i,j; for ( i=0; iy+3][stone->x]!=0 ) return 1; return 0; } static int xcheck(void) { int i,j; for ( i=0; iy][stone->x+side]!=0 || feld[stone->y+1][stone->x+side]!=0 || feld[stone->y+2][stone->x+side]!=0 ) return 1; return 0; } static void init_stone(void) { next.x=XWIDTH/2; next.y=1; next.c[0]=(int)(xrandom()%6+1); next.c[1]=(int)(xrandom()%6+1); next.c[2]=(int)(xrandom()%6+1); } static int check_feld(uint *lines) { int flags[XHEIGHT][XWIDTH]; int i,j; int ii; int done=0; memset(flags,0,sizeof(flags)); for ( i=FIRSTLINE; i=FIRSTLINE; ii--,i-- ) { while ( flags[i][j]!=0 ) i--; if ( i<0 ) i=0; if ( i!=ii ) { feld[ii][j]=feld[i][j]; if ( feld[ii][j]==0 ) dr_block(j,ii,0); else dr_block(j,ii,feld[ii][j]); } } for ( ; ii>=0; ii-- ) feld[ii][j]=0; } copy_out(); } return done; } int columns(void) { long time; int draw,let_it_fall,drop_line; uint level,delay; uint stones,lines,score; STONE x; KEY key; uint stat[6]={0,0,0,0,0,0}; init_feld(); while ( check_feld(&lines) ) ; level=opts.columns.start_level; delay=calc_delay(level); stones=lines=score=0; init_stone(); while ( 1 ) { stone=next; init_stone(); if ( preview_flag ) dr_preview(); stat[stone.c[0]-1]++; stat[stone.c[1]-1]++; stat[stone.c[2]-1]++; if ( stat_flag ) dr_stat(stat); if ( check_stone(&stone) || xcheck() ) /* game over? */ break; x=stone; /* stein merken */ stones++; if ( level<9 && lines>level*50+50 ) { level++; inv_feld(); delay=calc_delay(level); } dr_score(level,lines,stones,score); let_it_fall=0; /* nicht fallen lassen */ time=gettime(); /* zeit merken */ draw=1; /* zeichnen */ while ( 1 ) { if ( draw ) { /* nur wenn n”tig */ dr_stone(); /* stein zeichnen */ draw=0; /* flag l”schen */ copy_out(); } if ( !let_it_fall ) /* falls fallen lassen */ key=get_key(); else key=NO_KEY; /* kein zeichen einlesen */ switch ( key ) { case K_QUIT: return 0; /*break;*/ case K_LEFT: if ( !check_side(&x,-1) ) x.x--; break; case K_RIGHT: if ( !check_side(&x,+1) ) x.x++; break; case K_ROTATE: { int i; i=x.c[2]; x.c[2]=x.c[1]; x.c[1]=x.c[0]; x.c[0]=i; } break; case K_DROP: let_it_fall=1; drop_line=x.y; break; case K_LEVEL: if ( level<9 ) { level++; inv_feld(); delay=calc_delay(level); dr_score(level,lines,stones,score); } break; case K_NEXT: set_preview(); if ( preview_flag ) dr_preview(); break; case K_INFO: set_score(); break; case K_STAT: set_statistic(); if ( stat_flag ) dr_stat(stat); break; case K_STOP: xget_key(); /* taste mit warten holen */ time=gettime(); break; } if ( gettime()>time+delay || (let_it_fall && gettime()>time+1) ) { if ( check_stone(&x) )/* eins tiefer */ break; time=gettime(); x.y++; } if ( memcmp(&x,&stone,sizeof(x)) ) { draw=1; /* falls sich was getan hat */ rm_stone(); /* stein neuzeichnen */ stone=x; } } if ( memcmp(&x,&stone,sizeof(x)) ) { rm_stone(); /* stein neuzeichnen */ stone=x; dr_stone(); copy_out(); } /* stein ist unten angekommen */ /* eintragen ins feld */ feld[stone.y][stone.x]=stone.c[0]; feld[stone.y+1][stone.x]=stone.c[1]; feld[stone.y+2][stone.x]=stone.c[2]; /* steine wegr„umen */ while ( check_feld(&lines) ) ; /* score berechnen */ score+=5+level*2; if ( let_it_fall ) score+=XHEIGHT-1-drop_line; else score+=XHEIGHT-1-stone.y; if ( preview_flag ) score-=3; /* tastaturpuffer l”schen */ clr_keys(); } clr_keys(); dr_score(level,lines,stones,score); do_score(score,opts.col_hi); return 1; } int init_columns(void) { char name[16]; MFDB pic; int i; sprintf(name,"COLUMNS%1d.IMG",planes); if ( !load_img(name,&pic) ) { cbloecke=pic; if ( planes>1 ) { cbloecke.fd_addr=malloc(pic.fd_wdwidth*2l*planes*pic.fd_h); pic.fd_stand=1; cbloecke.fd_stand=0; vr_trnfm(handle,&pic,&cbloecke); } BLOCK_SW=BLOCK_W=cbloecke.fd_w/16; BLOCK_H=cbloecke.fd_h; columns_vdi=1; dr_block=vdidr_block; } else if ( planes==1 ) { dr_block=qdr_block; columns_vdi=0; } else { columns_vdi=-1; return 0; } for ( i=1; i