void DrawBoard( void ) { int x; int y; FBFillRect( 0, 0, 720, 576, BLACK ); for( y = 0; y < 6; y++ ) { for( x = 0; x < 7; x++ ) { FBCopyImage( x*48+64, y*48+96, 48, 48, dout ); } } FBOverlayImage( ipos*48+64+6, 48+4, 36, 40, 0, 0, WHITE, dred, 0,0,0); FBDrawFx2Logo( LOGO_X, LOGO_Y ); gettimeofday(&starttv,0); }
void DrawGhosts( void ) { int i; for ( i=0; i < 4; i++ ) { FBOverlayImage( ghost[i].x*32+ghost[i].x_minor, ghost[i].y*32+ghost[i].y_minor, 32, 32, ghost[i].x_minor, ghost[i].y_minor, ghost[i].c1, ghost_0_0, maze[ghost[i].y * MAZEW + ghost[i].x] == '.' ? futter : 0, ghost[i].x_minor && (maze[ghost[i].y * MAZEW + ghost[i].x +1 ] == '.') ? futter : 0, ghost[i].y_minor && (maze[(ghost[i].y+1)*MAZEW + ghost[i].x ] == '.' ) ? futter : 0 ); } }
static void Fall( int x, unsigned char *dr, char v ) { int y; for( y=0; y<6; y++ ) { if ( maze[ (5-y)*7 + x ] ) break; if(y) { msleep(100); FBCopyImage( x*48+64+6, y*48+48+4, 36, 40, dgray ); maze[ (6-y)*7 + x ] = 0; } else FBFillRect( x*48+64+6, y*48+48+4, 36, 40, BLACK ); maze[ (5-y)*7 + x ] = v; FBOverlayImage( x*48+64+6, y*48+96+4, 36, 40, 0, 0, WHITE, dr, dgray, dgray, dgray); #ifdef HAVE_SPARK_HARDWARE FBFlushGrafic(); #endif } }
void MoveMouse( void ) { static int locked = 0; int k; if ( locked ) { locked--; actcode=0xee; return; } k=0; switch( actcode ) { case RC_7 : k++; case RC_6 : k++; case RC_5 : k++; case RC_4 : k++; case RC_3 : k++; case RC_2 : k++; case RC_1 : k++; break; } if ( k ) ipos=k-1; switch( actcode ) { case RC_RIGHT : if ( ipos < 6 ) { FBFillRect( ipos*48+64+6, 48+4, 36, 40, BLACK ); ipos++; FBOverlayImage( ipos*48+64+6, 48+4, 36, 40, 0, 0, WHITE, dred, 0,0,0); locked=1; } break; case RC_LEFT : if ( ipos > 0 ) { FBFillRect( ipos*48+64+6, 48+4, 36, 40, BLACK ); ipos--; FBOverlayImage( ipos*48+64+6, 48+4, 36, 40, 0, 0, WHITE, dred, 0,0,0); locked=1; } break; case RC_7 : case RC_6 : case RC_5 : case RC_4 : case RC_3 : case RC_2 : case RC_1 : case RC_OK : locked=1; if ( maze[ipos+35] ) break; Fall( ipos, dred, 1 ); k=TestGameOver( 1 ); if ( GameOver(1) ) return; MyPlay(); if ( GameOver(2) ) return; ipos=3; FBOverlayImage( ipos*48+64+6, 48+4, 36, 40, 0, 0, WHITE, dred, 0,0,0); break; } }
static void CPlay( int x ) { FBOverlayImage( x*48+64+6, 48+4, 36, 40, 0, 0, WHITE, dblue, 0,0,0); msleep(700); Fall( x, dblue, 2 ); }