void draw_attr_colored_area(uchar x0, uchar y0, uchar x1, uchar y1, uchar attr) { uchar x, y; for (x = x0; x <= x1; x++) { for (y = y0; y <= y1; y++) { zx_cyx2aaddr(y, x)[0] = attr; } } }
void main() { restart: #ifdef JOYSTICK hit_border(); #ifndef LOMEM #if defined(MSX) || defined(SVI) || defined(SC3000) || defined(EINSTEIN) msx_text(); #endif #ifdef SPECTRUM #ifdef ZX81 hrg_off(); zx_colour(112); #endif #endif printf("%c",12); printf("\n CHOOSE YOUR JOYSTICK INTERFACE\n\n"); for (k=0 ; k!=GAME_DEVICES; k++) printf(" %u - %s\n\n",k+1,joystick_type[k]); stick=0; while ((stick<1) || (stick>GAME_DEVICES)) { stick=getk()-48; } #else stick=1; #endif #endif #ifdef SPECTRUM #ifdef ZX81 hrg_on(); zx_colour(112); #endif #endif #ifdef CLOCK srand(clock()); #endif tt=-1; #ifdef ZX81 #if (spritesize == 2) speed=500; #else speed=300; #endif #else #ifdef C128 #else speed=300; #endif #endif start_level: #ifdef ZX81 speed-=100; #else speed-=200; #endif tt++; t=0; p=1; clg(); hit_border(); #ifdef LAMBDA zx_border (INK_CYAN); zx_colour(112); #endif for (m=1; m<=4; m+=2) for (n=0; n<=30; n+=2) { putsprite(spr_or,(n*spritesize),((m+3)*spritesizeh),brick_l); putsprite(spr_or,((n+1)*spritesize),((m+3)*spritesizeh),brick_r); putsprite(spr_or,(n*spritesize),((m+4)*spritesizeh),brick_r); putsprite(spr_or,((n+1)*spritesize),((m+4)*spritesizeh),brick_l); #if (spritesize == 8) #ifdef SPECTRUM #ifdef ZX81 *zx_cyx2aaddr(m+3,n) = m<<4; *zx_cyx2aaddr(m+3,n+1) = m<<4; *zx_cyx2aaddr(m+4,n) = (m+1)<<4; *zx_cyx2aaddr(m+4,n+1) = (m+1)<<4; #else *zx_cyx2aaddr(m+3,n) = m<<3; *zx_cyx2aaddr(m+3,n+1) = m<<3; *zx_cyx2aaddr(m+4,n) = (m+1)<<3; *zx_cyx2aaddr(m+4,n+1) = (m+1)<<3; #endif #endif #endif #ifdef LAMBDA *zx_cyx2aaddr(m+3,n) = m<<4; *zx_cyx2aaddr(m+3,n+1) = m<<4; *zx_cyx2aaddr(m+4,n) = (m+1)<<4; *zx_cyx2aaddr(m+4,n+1) = (m+1)<<4; #endif #if defined(MSX) || defined(SVI) || defined(SC3000) || defined(MTX) || defined(EINSTEIN) #if (spritesize == 8) set_attr(m+3,n,((m+1)<<1)|0x10); set_attr(m+3,n+1,((m+1)<<1)|0x10); set_attr(m+4,n,(m<<1)|0x10); set_attr(m+4,n+1,(m<<1)|0x10); #endif #endif } for (n=0; n<=30; n+=2) { putsprite(spr_or,(n*spritesize),((m+3)*spritesizeh),brick_l); putsprite(spr_or,((n+1)*spritesize),((m+3)*spritesizeh),brick_r); #if (spritesize == 8) #ifdef SPECTRUM #ifdef ZX81 *zx_cyx2aaddr(m+3,n) = 6<<4; *zx_cyx2aaddr(m+3,n+1) = 6<<4; #else *zx_cyx2aaddr(m+3,n) = 6<<3; *zx_cyx2aaddr(m+3,n+1) = 6<<3; #endif #endif #endif #ifdef LAMBDA *zx_cyx2aaddr(m+3,n) = 6<<4; *zx_cyx2aaddr(m+3,n+1) = 6<<4; #endif #if defined(MSX) || defined(SVI) || defined(SC3000) || defined(MTX) || defined(EINSTEIN) #if (spritesize == 8) set_attr(m+3,n,LIGHT_YELLOW|0x10); set_attr(m+3,n+1,LIGHT_YELLOW|0x10); #endif #endif } u=0; v=0; a=14; t=0; w=0; for (r=0; r<=6; r++) { m=10; n=8+rand()%15; p=0; a=13; #if (spritesize == 2) putsprite(spr_or,(a*spritesize),(21*spritesizeh)-1,paddle); #else putsprite(spr_or,(a*spritesize),(21*spritesizeh),paddle); #endif #ifndef LOMEM for (i=0; i<=6; i++) { putsprite (spr_and, (24+i)*spritesize, 23*spritesizeh, ball); if (i>r) putsprite (spr_or, (24+i)*spritesize, 23*spritesizeh, ball); } #endif g=200; /* Let's show where the ball stars before the dance begins */ putsprite(spr_or,(n*spritesize),(m*spritesizeh),ball); hit_border(); #ifdef SOUND for (i=1; i<14; i++) { bit_synth(4, 199+i, 200+i, 239+i, 240+i); putsprite(spr_xor,(n*spritesize),(m*spritesizeh),ball); } bit_synth(9, 255, 254, 253, 252); #endif putsprite(spr_and,(n*spritesize),(m*spritesizeh),ball); while (m <= 20) { /* delay */ do_delay(); move_ball(); /* total score count is 574 */ if (t>=573) goto start_level; if (u==20) putsprite(spr_and,(v*spritesize),(u*spritesizeh),bounce); else putsprite(spr_and,(v*spritesize),(u*spritesizeh),ball); /* Intermediate step to move the ball smoothly */ putsprite(spr_xor,(((n+v)*spritesize)>>1),(((m+u)*spritesizeh)>>1),ball); do_delay(); putsprite(spr_xor,(((n+v)*spritesize)>>1),(((m+u)*spritesizeh)>>1),ball); u=m; v=n; if (m==20) putsprite(spr_or,(n*spritesize),(m*spritesizeh),bounce); else putsprite(spr_or,(n*spritesize),(m*spritesizeh),ball); /* #ifdef SOUND bit_click(); #endif */ #ifdef JOYSTICK if (joystick(stick) & MOVE_LEFT) { move_left(); if (joystick(stick) & MOVE_FIRE) move_left(); } if (joystick(stick) & MOVE_RIGHT) { move_right(); if (joystick(stick) & MOVE_FIRE) move_right(); } #else k=getk(); switch (k) { case '2': move_left(); break case '1': move_left(); move_left(); break; case '9': move_right(); break; case '0': move_right(); move_right(); break; } #endif } /* ball is lost */ #if (spritesize == 2) putsprite(spr_and,(a*spritesize),(21*spritesizeh)-1,paddle); #else putsprite(spr_and,(a*spritesize),(21*spritesizeh),paddle); #endif } #ifdef ZX81 #if (spritesize == 2) #asm ld a,$1e ld i,a #endasm #endif #endif #ifndef LOMEM #ifdef BANNERS putsprite(spr_or,40,(12*spritesizeh),scorebanner); sprintf (scoretxt,"%05u",tt*1000+t); k=0; for (i=0; i<5; i++) { putsprite (spr_or, 140+i+k, 12*spritesizeh+7, &bigdigit[(scoretxt[i]-48)*38]); if (scoretxt[i]=='1') k+=5; else k+=14; } #else printf("%c\n\n Score: %u ",12,tt*1000+t); #endif #endif /* return (tt*1000+t); */ #ifdef SOUND bit_fx2(5); #endif while (getk()) {} while (!getk()) {} goto restart; }
void destroy_brick() { t = t+13-m; b = abs(m-n); putsprite(spr_and,(n*spritesize),(m*spritesizeh),blank); #ifdef SPECTRUM #if (spritesize == 8) #ifdef ZX81 *zx_cyx2aaddr(m,n) = 112; #else *zx_cyx2aaddr(m,n) = 56; #endif #endif #endif #ifdef LAMBDA *zx_cyx2aaddr(m,n) = 112; #endif #if defined(MSX) || defined(SVI) || defined(SC3000) || defined(MTX) || defined(EINSTEIN) #if (spritesize == 8) set_attr (m,n,0x1f); #endif #endif if ((b&1) && (n>0)) { putsprite(spr_and,((n-1)*spritesize),(m*spritesizeh),blank); #ifdef SPECTRUM #if (spritesize == 8) #ifdef ZX81 *zx_cyx2aaddr(m,n-1) = 112; #else *zx_cyx2aaddr(m,n-1) = 56; #endif #endif #endif #ifdef LAMBDA *zx_cyx2aaddr(m,n-1) = 112; #endif #if defined(MSX) || defined(SVI) || defined(SC3000) || defined(MTX) || defined(EINSTEIN) #if (spritesize == 8) set_attr (m,n-1,0x1F); #endif #endif } if ((!(b&1)) && (n<31)) { putsprite(spr_and,((n+1)*spritesize),(m*spritesizeh),blank); #ifdef SPECTRUM #if (spritesize == 8) #ifdef ZX81 *zx_cyx2aaddr(m,n+1) = 112; #else *zx_cyx2aaddr(m,n+1) = 56; #endif #endif #endif #ifdef LAMBDA *zx_cyx2aaddr(m,n+1) = 112; #endif #if defined(MSX) || defined(SVI) || defined(SC3000) || defined(MTX) || defined(EINSTEIN) #if (spritesize == 8) set_attr (m,n+1,0x1F); #endif #endif } #ifdef SOUND bit_synth(10, 55, 54, 53, 52); #endif #ifndef LOMEM sprintf (scoretxt,"%05u",tt*1000+t); for (i=0; i<5; i++) { putsprite (spr_and, (2+i)*5, 23*spritesizeh-3, numblank); putsprite (spr_or, (2+i)*5, 23*spritesizeh-3, &numbers[(scoretxt[i]-48)*7]); } #endif }