void Startbildschirm() { int i; char tlevel[ 64 ]; // int x,y; // for (y=0; y<576; y=y+56) // { // for (x=0; x<720; x=x+64) // { // FB2CopyImage( x, y, 32, 28, man, 2); // } // } static int bx[] = { 64,32,0,0,0,32,64,64,64,32,0,128,160,192,192,192,192,192,160,128,128,128, 128,256,256,256,256,256,288,320,320,320,320,384,416,448,448,448,448,448,416, 384,384,384,384,512,544,576,224,224,224,224,224,256,288,288,256,288,288,256, 352,352,352,352,352,384,416,416,416,416,416,384,480,480,480,480,480,512,512, 544,544,576,576,576,576,576 }; static int by[] = { 0,0,0,28,56,56,56,84,112,112,112,0,0,0,28,56,84,112,112,112,84,56,28,0,28,56, 84,112,56,0,28,84,112,0,0,0,28,56,84,112,112,112,84,56,28,56,56,56,312,284,256, 228,200,200,200,228,256,284,312,312,312,284,256,228,200,200,200,228,256,284,312, 256,200,228,256,284,312,228,256,256,284,200,228,256,284,312 }; for (i=0;i<86;i++) { FBCopyImage(bx[i]+56,by[i]+118, 32, 28, wall ); } FBFillRect( 55, 365, 200 , 40, BLACK ); sprintf(tlevel,"%d",max_level); FBDrawString( 75,370, 30, tlevel, WHITE, BLACK ); FBDrawString( 120,370, 30, "Level gefunden", WHITE, BLACK); #ifdef USEX FBFlushGrafic(); #endif while( actcode != RC_OK ) { if (i>87) { i=0;} else {i++;} if (i<86) {FBCopyImage( bx[i]+56,by[i]+118, 32, 28, box );} if (i>=1 && i-1<=85) { FBCopyImage( bx[i-1]+56,by[i-1]+118, 32, 28, man );} if (i>=2 && i-2<=85) { FBCopyImage( bx[i-2]+56,by[i-2]+118, 32, 28, wall );} #ifdef USEX FBFlushGrafic(); #endif RcGetActCode( ); sleep(1); } FBFillRect( 0, 0, 720 , 576, BLACK ); }
int InitLemm( void ) { int i; #ifdef USEX FBFlushGrafic(); #endif FBFillRect( 0, 0, 720, 576, STEELBLUE ); FBFillRect( 60, 448, 300, 100, BLACK ); if ( !bgImage ) { FBDrawString(64,482,32,"Initialize...",WHITE,0); FBDrawFx2Logo( 320, 486 ); #ifdef USEX FBFlushGrafic(); #endif initNumbers(); if ( LoadPics() == -1 ) return -1; bgImage=malloc(1600*160); SoundStart(); } if ( !bgImage ) return -1; for( i=0; i<12; i++ ) svdimage[i]=malloc(32*48); for( i=0; i<320; i+=32 ) inSc( 19, 0, i+main_x, 352, 1 ); inSc( 29, 0, 66+main_x, 370, 1 ); inSc( 29, 1, 100+main_x, 372, 1 ); inSc( 8, 0, 134+main_x, 372, 0 ); // explosion inSc( 4, 10, 166+main_x, 374, 1 ); // lemming2 inSc( 29, 2, 200+main_x, 368, 1 ); inSc( 29, 3, 234+main_x, 368, 1 ); inSc( 29, 4, 264+main_x, 372, 1 ); inSc( 5, 2, 292+main_x, 368, 1 ); inSc( 20, 0, 320+main_x, 352, 1 ); FBDrawString(44,390,48,"-",GREEN,0); FBDrawString(76,390,48,"+",GREEN,0); return 0; }
static void ShowHScore( HScore *g ) { int i; int x; char pp[64]; FBFillRect( 0, 0, 720, 576, BLACK ); #ifdef HAVE_CURL if ( g==ihsc ) FBDrawString( 190, 32, 64, "Internet HighScore", RED, BLACK ); else #endif FBDrawString( 220, 32, 64, "HighScore", RED, BLACK ); for( i=0; i < 8; i++ ) { FBDrawString( 100, 100+i*48, 48, g[i].name, WHITE, 0 ); sprintf(pp,"%ld",g[i].points); x = FBDrawString( 400, 100+i*48, 48, pp, BLACK, BLACK ); FBDrawString( 500-x, 100+i*48, 48, pp, WHITE, BLACK ); } #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif while( realcode != 0xee ) RcGetActCode(); }
void CTable::Display() { bool some_changes = false; if( changed[ BLOCK ] ) { // some_changes = true; block.Draw( LEFT + 15, TOP, BLOCK == act_slot ); } if( changed[ WASTEPILE ] ) { wastepile.Draw( LEFT + 95, TOP, WASTEPILE == act_slot ); some_changes = true; } int i; for( i = 0; i < 4; i++ ) { if( changed[ FOUNDATION1 + i ] ) { foundation[i].Draw( LEFT+(4+i)*80, TOP, (FOUNDATION1 + i) == act_slot ); some_changes = true; } } if( changed[ HAND ] ) { hand.Draw( LEFT, TOP + 150 ); some_changes = true; } for( i = 0; i < 7; i++ ) { if( changed[ TABLEAU1 + i ] ) { tableau[i].Draw( LEFT+(1+i)*80, TOP + 150, (TABLEAU1 + i) == act_slot ); some_changes = true; } } memset( changed, 0, sizeof( changed ) ); #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) if( some_changes ) { FBCopyImage( 0, 0, WIDTH, HEIGHT, BBGetData() ); FBFlushGrafic(); } #else if( some_changes ) FBCopyImage( 0, 0, WIDTH, HEIGHT, BBGetData() ); #endif }
int CTable::Run() { BBSetBackground( BACK_C ); FBCopyImage( 0, 0, WIDTH, HEIGHT, BBGetData() ); FBDrawString( 300, 255, 42, "Loading...", 250, 0 ); #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif //Outer loop for initialization while( 0 == doexit ) { #ifdef MARTII this->Init(); #else // this->Init(); #endif this->Display(); //Inner loop for game controlling while( 0 == doexit ) { //Handle keys this->HandleKeysPressed(); if( 0 != doexit ) break; //Display changes } } return 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 } }
static void SaveGame( void ) { #ifdef HAVE_CURL CURL *curl; CURLcode res; FILE *fp; char url[ 512 ]; char *user=0; char luser[ 32 ]; int x; int n; char *p; struct timeval tv; unsigned long chk=0; doexit=0; #endif // HAVE_CURL if ( score < 31 ) return; LocalSave(); #ifdef HAVE_CURL LocalSave(); if ( !use_ihsc ) return; for( x=0; x < 8; x++ ) { if ( score > ihsc[x].points ) break; } if ( x == 8 ) return; FBDrawString( 100,230,64,"Inet-Send Highscore ? (OK/BLUE)",GREEN,0); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif while( realcode != 0xee ) RcGetActCode(); actcode=0xee; while( !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; select( 0,0,0,0, &tv ); RcGetActCode(); if ( actcode == RC_BLUE ) return; if ( actcode == RC_OK ) break; } if ( doexit ) return; if ( localuser != -1 ) { strcpy(luser,hsc[localuser].name); user=luser; } else { Fx2PigPause(); FBFillRect( 500,32,3*52,4*52+4,BLACK ); FBFillRect( 150,420,470,64,BLACK ); FBDrawRect( 149,419,472,66,WHITE ); FBDrawRect( 148,418,474,68,WHITE ); x=FBDrawString( 154,420,64,"name : ",WHITE,0); user=FBEnterWord(154+x,420,64,9,WHITE); Fx2PigResume(); } n=FBDrawString( 210,360,48,"sending",BLACK,WHITE); /* clean name */ x = strlen(user); p=user; for( p=user; *p; x--, p++ ) { if (( *p == ' ' ) || ( *p == '&' ) || ( *p == '/' )) memcpy(p,p+1,x); } chk=BuildCheck( user, score ); sprintf(url,"%s/games/tetris.php?action=put&user=%s&score=%ld&chk=%lu", hscore,user,score,chk); curl = curl_easy_init(); if ( !curl ) return; fp = fopen( "/var/tmp/trash", "w"); if ( !fp ) { curl_easy_cleanup(curl); return; } curl_easy_setopt( curl, CURLOPT_URL, url ); curl_easy_setopt( curl, CURLOPT_FILE, fp ); curl_easy_setopt( curl, CURLOPT_NOPROGRESS, TRUE ); if ( proxy_addr ) { curl_easy_setopt( curl, CURLOPT_PROXY, proxy_addr ); if ( proxy_user ) curl_easy_setopt( curl, CURLOPT_PROXYUSERPWD, proxy_user ); } res = curl_easy_perform(curl); FBFillRect( 210,360,n,48,GRAY); if ( !res ) FBDrawString( 210,360,48,"success",GREEN,GRAY); else FBDrawString( 210,360,48,"failed",RED,GRAY); curl_easy_cleanup(curl); fclose( fp ); unlink( "/var/tmp/trash" ); LoadHScore(); return; #endif // HAVE_CURL }
int snake_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int x; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; Fx2ShowPig( 540, 449, 135, 96 ); while ( doexit != 3 ) { DrawMaze( ); /* 0 = all */ doexit=0; while ( !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 10ms pause */ RcGetActCode( ); MoveSnake(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif } FreeSnake(); if ( doexit != 3 ) { actcode=0xee; DrawFinalScore(); DrawGameOver(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif doexit=0; while (( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 200000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); } } } Fx2StopPig(); /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while ( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } RcClose(); FBClose(); return 0; }
int pacman_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int x; int jumplevel=-1; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; InitLevel( 0 ); while( doexit != 3 ) { MazeInitialize(); DrawMaze( ); /* 0 = all */ DrawFill(); DrawGhosts( ); DrawPac( ); MazePig(); doexit=0; while( !doexit ) { tv.tv_sec = 0; #ifdef HAVE_DREAMBOX_HARDWARE tv.tv_usec = 8000; #else tv.tv_usec = 1000; #endif x = select( 0, 0, 0, 0, &tv ); /* 10ms pause */ MovePac( ); MoveGhosts( ); DrawGhosts( ); DrawPac( ); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif RcGetActCode( ); CheckGhosts( ); } if ( doexit != 3 ) { actcode=0xee; if ( score ) DrawScore(); if ( !gametime ) DrawGameOver(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif doexit=0; jumplevel=-1; while(( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); if ( actcode == RC_HELP ) { while( realcode != 0xee ) RcGetActCode( ); actcode=0xee; while(( actcode == 0xee ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); } if ( actcode <= RC_9 ) { jumplevel=actcode; actcode=RC_OK; } } } if ( gametime ) NextLevel(); else InitLevel( jumplevel ); } } Fx2StopPig(); /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } RcClose(); FBClose(); return 0; }
int mines_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int x; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; while( doexit != 3 ) { BoardInitialize(); DrawBoard( 0 ); Fx2ShowPig( 470, 300, 176, 144 ); doexit=0; while( !doexit ) { tv.tv_sec = 0; tv.tv_usec = 10000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); MoveMouse(); #ifdef USEX FBFlushGrafic(); #endif } if ( doexit != 3 ) { actcode=0xee; if ( doexit ==2 ) DrawScore(); else DrawGameOver(); #ifdef USEX FBFlushGrafic(); #endif doexit=0; while(( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); } } } Fx2StopPig(); /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } RcClose(); FBClose(); return 0; }
static void SortBouquet( Channel *ch, int num ) { int i; int color; int p1=0; int pos=0; int w=0; int redraw=0; int mode=0; int x; int x2; struct timeval tv; Channel chs; char text[16]; FBFillRect( 0,0,720,576,BLACK); FBDrawString( 200, 32, 48, ch==tv_ch?"TV bouquet":"Radio bouquet",RED,0); while( realcode != 0xee ) RcGetActCode(); actcode=0xee; while( !doexit ) { if ( w ) FBFillRect( 150, 90, w+150, 44*9+48, BLACK ); w=0; for( i=p1; i<p1+10; i++ ) { sprintf(text,"%d",i+1); x2=FBDrawString( 150,90+(i-p1)*44,48,text,BLACK,0); FBDrawString( 260-x2,90+(i-p1)*44,48,text,GRAY,0); color= ch[i].flag == '0' ? GRAY : GRAY2; if ( i== pos ) color=mode?RED:WHITE; x=FBDrawString( 300,90+(i-p1)*44,48,ch[i].name,color,0); if ( x > w ) w=x; } FBDrawString( 50, 100, 32, "OK select",GRAY,0); FBFillRect( 50, 142, 8, 8, BLUE ); FBDrawString( 62, 130, 32, "hide/show",GRAY,0); FBFillRect( 50, 172, 8, 8, RED ); FBDrawString( 62, 160, 32, "save",GRAY,0); FBFillRect( 50, 202, 8, 8, YELLOW ); FBDrawString( 62, 190, 32, ch==tv_ch?"radio":"tv",GRAY,0); #ifdef USEX FBFlushGrafic(); #endif while( realcode != 0xee ) RcGetActCode(); redraw=0; while( !doexit && !redraw ) { tv.tv_sec = 0; tv.tv_usec = 200000; select( 0,0,0,0,&tv ); actcode=0xee; RcGetActCode(); if ( actcode == 0xee ) continue; switch( actcode ) { case RC_UP : if ( pos == 0 ) continue; pos--; if ( mode ) { memcpy(&chs,ch+pos+1,sizeof(Channel)); memcpy(ch+pos+1,ch+pos,sizeof(Channel)); memcpy(ch+pos,&chs,sizeof(Channel)); } if ( pos < p1 ) { p1 -= 9; redraw=1; if ( p1 < 0 ) p1 = 0; } else { if ( mode ) { FBDrawString( 300,90+(pos+1-p1)*44,48, ch[pos].name, BLACK,0); FBDrawString( 300,90+(pos-p1)*44,48, ch[pos+1].name, BLACK,0); } color= ch[pos+1].flag == '0' ? GRAY : GRAY2; FBDrawString( 300,90+(pos+1-p1)*44,48,ch[pos+1].name, color,0); color=mode?RED:WHITE; FBDrawString( 300,90+(pos-p1)*44,48,ch[pos].name, color,0); } break; case RC_DOWN : if ( pos == num-1 ) continue; pos++; if ( mode ) { memcpy(&chs,ch+pos-1,sizeof(Channel)); memcpy(ch+pos-1,ch+pos,sizeof(Channel)); memcpy(ch+pos,&chs,sizeof(Channel)); } if ( pos > p1+9 ) { p1 += 9; redraw=1; if ( p1 > num-10 ) p1 = num-10; } else { if ( mode ) { FBDrawString( 300,90+(pos-1-p1)*44,48, ch[pos].name, BLACK,0); FBDrawString( 300,90+(pos-p1)*44,48, ch[pos-1].name, BLACK,0); } color= ch[pos-1].flag == '0' ? GRAY : GRAY2; FBDrawString( 300,90+(pos-1-p1)*44,48,ch[pos-1].name, color,0); color=mode?RED:WHITE; FBDrawString( 300,90+(pos-p1)*44,48,ch[pos].name, color,0); } break; case RC_BLUE : ch[pos].flag = ch[pos].flag == '0' ? '1' : '0'; break; case RC_OK : color=mode?WHITE:RED; FBDrawString( 300,90+(pos-p1)*44,48,ch[pos].name, color,0); mode=!mode; break; case RC_RED : doexit=1; break; case RC_YELLOW : doexit=2; break; } #ifdef USEX FBFlushGrafic(); #endif while( realcode != 0xee ) RcGetActCode(); } } }
static void LoadHScore( void ) { CURL *curl; CURLcode res; FILE *fp; char url[ 512 ]; char *p; int i; FBDrawString( 150,32,32,"try load high score from",GRAY,0); FBDrawString( 150,64,32,hscore,GRAY,0); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif sprintf(url,"%s/games/tetris.php?action=get",hscore); curl = curl_easy_init(); if ( !curl ) return; fp = fopen( "/var/tmp/trash", "w"); if ( !fp ) { curl_easy_cleanup(curl); return; } curl_easy_setopt( curl, CURLOPT_URL, url ); curl_easy_setopt( curl, CURLOPT_FILE, fp ); curl_easy_setopt( curl, CURLOPT_NOPROGRESS, TRUE ); if ( proxy_addr ) { curl_easy_setopt( curl, CURLOPT_PROXY, proxy_addr ); if ( proxy_user ) curl_easy_setopt( curl, CURLOPT_PROXYUSERPWD, proxy_user ); } res = curl_easy_perform(curl); curl_easy_cleanup(curl); fclose( fp ); if ( res ) return; fp=fopen( "/var/tmp/trash", "r" ); if ( !fp ) return; for( i=0; i<8; i++ ) { if ( !fgets(url,512,fp) ) break; p=strchr(url,'\n'); if ( p ) *p=0; p=strchr(url,'&'); if ( !p ) break; *p=0; p++; strncpy(ihsc[i].name,url,10); ihsc[i].name[9]=0; ihsc[i].points = atoi(p); } if ( i==8 ) use_ihsc=1; fclose(fp); unlink("/var/tmp/trash"); }
int master_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int x; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; while( doexit != 3 ) { MasterInitialize(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif Fx2ShowPig( 430, 355, 176, 144 ); doexit=0; while( !doexit ) { tv.tv_sec = 0; tv.tv_usec = 200000; select( 0, 0, 0, 0, &tv ); actcode=0xee; RcGetActCode( ); Play(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif while( realcode != 0xee ) RcGetActCode( ); } if ( doexit == 4 ) // level changed { doexit=0; continue; } if ( doexit != 3 ) { actcode=0xee; #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif doexit=0; while(( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); if (( actcode > 0 ) && (actcode < 5 )) { Play(); doexit=1; } } } } Fx2StopPig(); /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } RcClose(); FBClose(); return 0; }
void CTable::HandleKeysPressed() { static bool HelpOnScreen = false; static bool MenuOnScreen = false; timeval tv; tv.tv_sec = 0; tv.tv_usec = 60000; select( 0, 0, 0, 0, &tv ); /* 60ms pause */ RcGetActCode(); if( realcode == 0xee ) return; if( true == HelpOnScreen ) { FBCopyImage( 0, 0, WIDTH, HEIGHT, BBGetData() ); #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif HelpOnScreen = false; return; } switch( actcode ) { case RC_0 : ChangeSelection( false ); changed[ act_slot ] = true; changed[ BLOCK ] = true; act_slot = BLOCK; ChangeSelection( ); break; case RC_1 : ChangeSelection( false ); changed[ act_slot ] = true; changed[ TABLEAU1 ] = true; act_slot = TABLEAU1; ChangeSelection( true, false ); break; case RC_2 : ChangeSelection( false ); changed[ act_slot ] = true; changed[ TABLEAU2 ] = true; act_slot = TABLEAU2; ChangeSelection( true, false ); break; case RC_3 : ChangeSelection( false ); changed[ act_slot ] = true; changed[ TABLEAU3 ] = true; act_slot = TABLEAU3; ChangeSelection( true, false ); break; case RC_4 : ChangeSelection( false ); changed[ act_slot ] = true; changed[ TABLEAU4 ] = true; act_slot = TABLEAU4; ChangeSelection( true, false ); break; case RC_5 : ChangeSelection( false ); changed[ act_slot ] = true; changed[ TABLEAU5 ] = true; act_slot = TABLEAU5; ChangeSelection( true, false ); break; case RC_6 : ChangeSelection( false ); changed[ act_slot ] = true; changed[ TABLEAU6 ] = true; act_slot = TABLEAU6; ChangeSelection( true, false ); break; case RC_7 : ChangeSelection( false ); changed[ act_slot ] = true; changed[ TABLEAU7 ] = true; act_slot = TABLEAU7; ChangeSelection( true, false ); break; case RC_8 : break; case RC_9 : break; case RC_RIGHT : this->MoveCursor( 2 ); break; case RC_LEFT : this->MoveCursor( 0 ); break; case RC_UP : this->MoveCursor( 1 ); break; case RC_DOWN : this->MoveCursor( 3 ); break; case RC_OK : this->DoAction(); break; case RC_SPKR : break; case RC_STANDBY : break; case RC_GREEN : break; case RC_YELLOW : FBPrintScreen(); break; case RC_RED : this->Init(); #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif break; case RC_BLUE : Wizard(); #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif break; case RC_PLUS : changed[ act_slot ] = true; ChangeSelection( true, false ); break; case RC_MINUS : changed[ act_slot ] = true; ChangeSelection( false, false ); break; case RC_HELP : this->ShowHelp(); #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif HelpOnScreen = true; break; case RC_SETUP : if( this->Setup() ) this->Init(); FBCopyImage( 0, 0, WIDTH, HEIGHT, BBGetData() ); #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif break; case RC_HOME : break; case RC_PAGE_DOWN : break; case RC_PAGE_UP : break; default: // return; break; } this->Display(); actcode = 0; }
bool CTable::Setup() { const int Hx = 100; const int Hy = 100; const int Hwidth = 520; const int Hheight = 376; bool SomeChanges = true; bool FirstRun = true; int loiShowCards = ShowCards; while( 1 ) { timeval tv; tv.tv_sec = 0; tv.tv_usec = 60000; select( 0, 0, 0, 0, &tv ); /* 60ms pause */ RcGetActCode(); if( false == FirstRun && realcode == 0xee ) continue; switch( actcode ) { case RC_OK : ShowCards = loiShowCards; return true; break; case RC_RIGHT : case RC_LEFT : if( 3 == loiShowCards ) loiShowCards = 1; else loiShowCards = 3; SomeChanges = true; break; case RC_SETUP : if( FirstRun ) break; RcGetActCode(); return false; break; } if( SomeChanges ) { unsigned char FC = Convert_24_8( 0,0,128); unsigned char BC = Convert_24_8( 255,255,0); if( FirstRun ) { FBFillRect( Hx+8, Hy+8, Hwidth, Hheight, Convert_24_8( 0,0,0) ); FBFillRect( Hx, Hy, Hwidth, Hheight, 19 ); } FBDrawHLine( Hx + 5, Hy + 55, 400, Convert_24_8( 255,255,255) ); FBDrawHLine( Hx + 5, Hy + 56, 400, Convert_24_8( 255,255,255) ); FBDrawString( Hx + 5, Hy + 5, 48, "Setup", Convert_24_8( 255,255,255), 0 ); FBDrawString( Hx + 5, Hy + 102, 32, "Open cards:", Convert_24_8( 255,255,255), 0 ); FBFillRect( Hx + 150, Hy + 102, 100, 32, loiShowCards==3?BC:19 ); FBFillRect( Hx + 260, Hy + 102, 100, 32, loiShowCards==1?BC:19 ); FBDrawString( Hx + 160, Hy + 102, 32, "3 Cards", loiShowCards==3?FC:Convert_24_8( 255,255,255), 0 ); FBDrawString( Hx + 270, Hy + 102, 32, "1 Card", loiShowCards==1?FC:Convert_24_8( 255,255,255), 0 ); FBDrawString( Hx + 5, Hy + 333, 24, "(OK) - Accept changes, (DBOX) - Cancel", Convert_24_8( 255,255,255), 0 ); #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif } SomeChanges = false; FirstRun = false; } return false; }
void MoveMouse() { static int locked = 0; int dx=0; int dy=0; char zug=' '; if ( locked ) { locked--; actcode=0xee; return; } switch( actcode ) { case RC_RIGHT : // Pinguin nach rechts if ( man_x+1 < MAZEW ) { dx = 1; dy = 0; zug = 'r'; locked=1; } break; case RC_LEFT : // Pinguin nach links if ( man_x > 1 ) { dx = -1; dy = 0; zug = 'l'; locked=1; } break; case RC_DOWN : // Pinguin nach unten if ( man_y+1 < MAZEH ) { dx = 0; dy = 1; zug = 'd'; locked=1; } break; case RC_UP : // Pinguin nach oben if ( man_y > 1 ) { dx = 0; dy = -1; zug = 'u'; locked=1; } break; case RC_MINUS : // letzte Züge rückgängig machen if (moves>0) { if (getField(man_x,man_y)=='@') { setField(man_x,man_y,' '); } else { setField(man_x,man_y,'.'); } if (Zuege[moves]=='r' || Zuege[moves]=='R') { man_x--; dx=1; } else if (Zuege[moves]=='l' || Zuege[moves]=='L') { man_x++; dx=-1; } else if (Zuege[moves]=='u' || Zuege[moves]=='U') { man_y++; dy=-1; } else if (Zuege[moves]=='d' || Zuege[moves]=='D') { man_y--; dy=1; } if (getField(man_x,man_y)==' ') { setField(man_x,man_y,'@'); } else { setField(man_x,man_y,'+'); } if (isupper(Zuege[moves])) { if (getField(man_x+2*dx,man_y+2*dy)=='$') { setField(man_x+2*dx,man_y+2*dy,' '); } else { setField(man_x+2*dx,man_y+2*dy,'.'); } if (getField(man_x+dx,man_y+dy)==' ') { setField(man_x+dx,man_y+dy,'$'); } else { setField(man_x+dx,man_y+dy,'*'); } pushes--; } moves--; dx=0; dy=0; DrawBoard(); DrawScore(); } locked=1; break; case RC_PLUS : // Rückgängig rückgängig machen if (Zuege[moves+1]!=' ') { if (Zuege[moves+1]=='r' || Zuege[moves+1]=='R') { dx=1; } else if (Zuege[moves+1]=='l' || Zuege[moves+1]=='L') { dx=-1; } else if (Zuege[moves+1]=='u' || Zuege[moves+1]=='U') { dy=-1; } else if (Zuege[moves+1]=='d' || Zuege[moves+1]=='D') { dy=1; } } locked=1; break; case RC_RED : // vorheriges Level - bei angefangenem Level nachfragen, ob wirklich sicher if (moves!=0) { FBFillRect( 160, 70, 400, 436, B ); FBDrawString( 160,75, 30, "Das Level ist noch nicht beendet!", WHITE, 0 ); FBDrawString( 160,110, 30, "ROT abbruch", WHITE, 0 ); FBDrawString( 160,140, 30, "OK naechstes Level", WHITE, 0 ); #ifdef USEX FBFlushGrafic(); #endif actcode=0xee; while( actcode != RC_OK && actcode != RC_RED ) { RcGetActCode(); } } if (actcode == RC_OK || moves==0) { if (level > 0) { level--; BoardInitialize(); } else { level = max_level-1; BoardInitialize(); } } else { FBFillRect( 0, 0, 720, 576, BLACK ); DrawBoard(); DrawScore(); } locked=1; break; case RC_GREEN : // naechstes Level - bei angefangenem Level nachfragen, ob wirklich sicher if (moves!=0) { FBFillRect( 160, 70, 400, 436, B ); FBDrawString( 160,75, 30, "Das Level ist noch nicht beendet!", WHITE, 0 ); FBDrawString( 160,110, 30, "ROT abbruch", WHITE, 0 ); FBDrawString( 160,140, 30, "OK vorheriges Level", WHITE, 0 ); #ifdef USEX FBFlushGrafic(); #endif actcode=0xee; while( actcode != RC_OK && actcode != RC_RED ) { RcGetActCode(); } } if (actcode == RC_OK || moves==0) { if (level+1 < max_level) { level++; BoardInitialize(); } else { level = 0; BoardInitialize(); } } else { FBFillRect( 0, 0, 720, 576, BLACK ); DrawBoard(); DrawScore(); } locked=1; break; case RC_YELLOW : // Randfelder ('a') aus-/einblenden if (Rand == 0) { Rand = 1; } else { Rand = 0; } locked=1; FBFillRect( 0, 0, 720, 576, BLACK ); DrawBoard(); DrawScore(); FBDrawString( 300, 510, 30, levelname[level], WHITE, 0 ); break; case RC_BLUE : // Level von vorne beginnen - bei angefangenem Level nachfragen, ob wirklich sicher if (moves!=0) { FBFillRect( 160, 70, 400, 436, B ); FBDrawString( 160,75, 30, "Das Level ist noch nicht beendet!", WHITE, 0 ); FBDrawString( 160,110, 30, "ROT abbruch", WHITE, 0 ); FBDrawString( 160,140, 30, "OK vorheriges Level", WHITE, 0 ); #ifdef USEX FBFlushGrafic(); #endif actcode=0xee; while( actcode != RC_OK && actcode != RC_RED ) { RcGetActCode(); } } if (actcode == RC_OK || moves==0) { BoardInitialize(); } else { FBFillRect( 0, 0, 720, 576, BLACK ); DrawBoard(); DrawScore(); } locked=1; break; case RC_HELP : // Hilfe anzeigen locked=1; FBFillRect( 160, 70, 400, 436, B ); FBDrawString( 160, 70, 30, "ROT vorheriges Level", WHITE, 0 ); FBDrawString( 160,100, 30, "GRUEN naechstes Level", WHITE, 0 ); FBDrawString( 160,130, 30, "GELB Rand ein/aus", WHITE, 0 ); FBDrawString( 160,160, 30, "BLAU Level neu starten", WHITE, 0 ); FBDrawString( 160,190, 30, "MINUS Zug zurueck", WHITE, 0 ); FBDrawString( 160,220, 30, "PLUS Zug vor", WHITE, 0 ); FBDrawString( 160,260, 30, "HOME Spiel beenden", WHITE, 0 ); FBDrawString( 160,290, 30, "STUMM Spiel aus-/einblenden", WHITE, 0 ); FBDrawString( 160,330, 30, "HILFE diese Hilfe", WHITE, 0 ); FBDrawString( 160,370, 30, "OK weiter", WHITE, 0 ); #ifdef USEX FBFlushGrafic(); #endif actcode=0xee; while( actcode != RC_OK ) { RcGetActCode( ); } FBFillRect( 0, 0, 720, 576, BLACK ); DrawBoard(); DrawScore(); FBDrawString( 300, 510, 30, levelname[level], WHITE, 0 ); break; } if (dx != 0 || dy != 0) // Soll Pinguin verschoben werden? { if (getField(man_x+dx, man_y+dy) == ' ') // Zug auf leeres Feld - keine Kiste vorhanden { if (getField(man_x,man_y)=='@') {setField(man_x,man_y,' ');} else {setField(man_x,man_y,'.');} DrawField(man_x, man_y); man_x += dx; dx = 0; man_y += dy; dy = 0; setField(man_x,man_y,'@'); DrawField(man_x, man_y); moves++; DrawScore(); } else if (getField(man_x+dx, man_y+dy) == '.') // Zug auf Zielfeld - keine Kiste vorhanden { if (getField(man_x,man_y)=='@') {setField(man_x,man_y,' ');} else {setField(man_x,man_y,'.');} DrawField(man_x, man_y); man_x += dx; dx = 0; man_y += dy; dy = 0; setField(man_x,man_y,'+'); DrawField(man_x, man_y); moves++; DrawScore(); } else if (getField(man_x+dx, man_y+dy) == '$' && getField(man_x+(2*dx), man_y+(2*dy)) == ' ') // Zug auf Feld mit Kiste - Kiste auf leeres Feld { setField(man_x+(2*dx), man_y+(2*dy),'$'); setField(man_x+dx, man_y+dy,' '); DrawField(man_x+(2*dx), man_y+(2*dy)); if (getField(man_x,man_y)=='@') {setField(man_x,man_y,' ');} else {setField(man_x,man_y,'.');} DrawField(man_x, man_y); man_x += dx; dx = 0; man_y += dy; dy = 0; setField(man_x,man_y,'@'); DrawField(man_x, man_y); moves++; pushes++; zug = toupper (zug); DrawScore(); } else if (getField(man_x+dx, man_y+dy) == '$' && getField(man_x+(2*dx), man_y+(2*dy)) == '.') // Zug auf Feld mit Kiste - Kiste auf Zielfeld { setField(man_x+(2*dx), man_y+(2*dy),'*'); setField(man_x+dx, man_y+dy,' '); DrawField(man_x+(2*dx), man_y+(2*dy)); if (getField(man_x,man_y)=='@') {setField(man_x,man_y,' ');} else {setField(man_x,man_y,'.');} DrawField(man_x, man_y); man_x += dx; dx = 0; man_y += dy; dy = 0; setField(man_x,man_y,'@'); DrawField(man_x, man_y); moves++; pushes++; zug = toupper (zug); DrawScore(); } else if (getField(man_x+dx, man_y+dy) == '*' && getField(man_x+(2*dx), man_y+(2*dy)) == ' ') // Zug auf Zielfeld mit Kiste - Kiste auf leeres Feld { setField(man_x+(2*dx), man_y+(2*dy),'$'); setField(man_x+dx, man_y+dy,'.'); DrawField(man_x+(2*dx), man_y+(2*dy)); if (getField(man_x,man_y)=='@') {setField(man_x,man_y,' ');} else {setField(man_x,man_y,'.');} DrawField(man_x, man_y); man_x += dx; dx = 0; man_y += dy; dy = 0; setField(man_x,man_y,'+'); DrawField(man_x, man_y); moves++; pushes++; zug = toupper (zug); DrawScore(); } else if (getField(man_x+dx, man_y+dy) == '*' && getField(man_x+(2*dx), man_y+(2*dy)) == '.') // Zug auf Zielfeld mit Kiste - Kiste auf Zielfeld { setField(man_x+(2*dx), man_y+(2*dy),'*'); setField(man_x+dx, man_y+dy,'.'); DrawField(man_x+(2*dx), man_y+(2*dy)); if (getField(man_x,man_y)=='@') {setField(man_x,man_y,' ');} else {setField(man_x,man_y,'.');} DrawField(man_x, man_y); man_x += dx; dx = 0; man_y += dy; dy = 0; setField(man_x,man_y,'+'); DrawField(man_x, man_y); moves++; pushes++; zug = toupper (zug); DrawScore(); } else { zug = ' '; } } if (zug !=' ') { Zuege[moves]=zug; } if (win() == 1) // durch letzten Zug gewonnen? { if (level+1 < max_level) { level++; } else { level = 0; } doexit=1; } #ifdef USEX FBFlushGrafic(); #endif return; }
int tetris_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int x; int i; int fd; FILE *fp; char *line; char *p; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; /* load setup */ fp = fopen( CONFIGDIR "/games.cfg", "r" ); if ( fp ) { line=malloc(128); isalloc=1; #ifdef HAVE_CURL proxy_addr=0; proxy_user=0; #endif hscore=0; while( fgets( line, 128, fp ) ) { if ( *line == '#' ) continue; if ( *line == ';' ) continue; p=strchr(line,'\n'); if ( p ) *p=0; p=strchr(line,'='); if ( !p ) continue; *p=0; p++; #ifdef HAVE_CURL if ( !strcmp(line,"proxy") ) proxy_addr=strdup(p); else if ( !strcmp(line,"proxy_user") ) proxy_user=strdup(p); else if ( !strcmp(line,"hscore") ) hscore=strdup(p); #endif } fclose(fp); free(line); } fd = open( GAMESDIR "/tetris.hscore", O_RDONLY ); if ( fd == -1 ) { mkdir( GAMESDIR, 567 ); for( i=0; i < 8; i++ ) { strcpy(hsc[i].name,"nobody"); hsc[i].points=30; } } else { read( fd, hsc, sizeof(hsc) ); close(fd); } #ifdef HAVE_CURL if ( hscore ) { LoadHScore(); } #endif #if defined(HAVE_DBOX_HARDWARE) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) Fx2ShowPig( 480, 400, 176, 144 ); #endif while( doexit != 3 ) { BoardInitialize(); DrawBoard( ); /* 0 = all */ NextItem(); #ifdef HAVE_DREAMBOX_HARDWARE Fx2ShowPig(480, 400, 176, 144 ); #endif doexit=0; while( !doexit ) { tv.tv_sec = 0; tv.tv_usec = 10000; x = select( 0, 0, 0, 0, &tv ); /* 10ms pause */ RcGetActCode( ); if ( doexit ) break; tv.tv_sec = 0; tv.tv_usec = 10000; x = select( 0, 0, 0, 0, &tv ); /* 10ms pause */ RcGetActCode( ); if ( doexit ) break; MoveSide(); if ( !FallDown() ) { RemoveCompl(); if ( !NextItem() ) doexit=1; } #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif RcGetActCode( ); } if ( doexit != 3 ) { actcode=0xee; DrawGameOver(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif doexit=0; SaveGame(); #ifdef HAVE_CURL if ( use_ihsc ) ShowIHScore(); #endif ShowHScore(hsc); Fx2PigPause(); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif i=0; actcode=0xee; while(( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); i++; if ( i == 50 ) { FBDrawString( 190, 480, 48, "press OK for new game",GRAY,0); #if defined(USEX) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FBFlushGrafic(); #endif } } Fx2PigResume(); } } Fx2StopPig(); #if defined(HAVE_DBOX_HARDWARE) || defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } #endif RcClose(); FBClose(); /* save hscore */ fd = open( GAMESDIR "/tetris.hscore", O_CREAT|O_WRONLY, 438 ); if ( fd != -1 ) { write( fd, hsc, sizeof(hsc) ); close(fd); } if ( isalloc ) { #ifdef HAVE_CURL if ( proxy_addr ) free ( proxy_addr ); if ( proxy_user ) free ( proxy_user ); #endif if ( hscore ) free ( hscore ); } return 0; }
static void SaveServices( void ) { FILE *fp; Channel *ch; int i; int n; int nr; char *p; char *p2; int perc; int lp=-1; FBDrawString( 62, 160, 32, "save",BLACK,GRAY); #ifdef USEX FBFlushGrafic(); #endif fp = fopen( CONFIGDIR "/zapit/services.xml", "w" ); if ( !fp ) return; FBFillRect( 96, 226, 508, 24, WHITE ); FBFillRect( 100, 230, 500, 16, GRAY2 ); for( n=0; n<num_lines; n++ ) { perc=n*500/num_lines; if ( perc != lp ) { FBFillRect( 100, 230, perc, 16, GRAY ); #ifdef USEX FBFlushGrafic(); #endif } nr=0; ch=tv_ch; for( i=0; i<num_ch_tv;i++ ) if ( tv_ch[i].line == lines[n] ) break; if ( i==num_ch_tv ) { ch=radio_ch; for( i=0; i<num_ch_radio;i++ ) if ( radio_ch[i].line == lines[n] ) break; if ( i == num_ch_radio ) ch=0; else nr=i; } else nr=i; if ( !ch ) { fprintf(fp,"%s",lines[n]); continue; } p=strstr(lines[n],"serviceType="); p+=14; *p = ch[nr].flag; p2=strstr(lines[n],"channelNR="); p2+=11; for( p=lines[n]; p!=p2; p++ ) fprintf(fp,"%c",*p); fprintf(fp,"%d",nr+1); p=strchr(p,'"'); for( ; *p; p++ ) fprintf(fp,"%c",*p); } fclose(fp); }
int bouquet_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int t; int r; int i; int idx=0; int cnum; int x; Channel *ch=NULL; FILE *fp; char line[512]; char l2[512]; char *p; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; /* load setup */ fp = fopen( CONFIGDIR "/zapit/services.xml", "r" ); if ( !fp ) { FBDrawString( 190, 100, 64, "services.xml not found !", RED, 0 ); #ifdef USEX FBFlushGrafic(); #endif tv.tv_sec = 5; tv.tv_usec = 0; select( 0, 0, 0, 0, &tv ); RcClose(); FBClose(); return 0; } while( fgets(line,512,fp) ) { num_lines++; if ( strstr(line,"channelNR") ) { p=strstr(line,"serviceType"); if ( p && (*(p+15) == '0') ) { p+=16; if ( *p == '1' ) num_ch_tv++; if ( *p == '2' ) num_ch_radio++; if ( *p == '4' ) num_ch_tv++; } } } fclose(fp); lines = (char**)malloc(sizeof(char*)*num_lines); tv_ch = (Channel*)malloc(sizeof(Channel)*num_ch_tv); radio_ch = (Channel*)malloc(sizeof(Channel)*num_ch_radio); for( i=0;i<num_ch_tv;i++) tv_ch[i].flag=0; for( i=0;i<num_ch_radio;i++) radio_ch[i].flag=0; fp = fopen( CONFIGDIR "/zapit/services.xml", "r" ); t=num_ch_tv-1; r=num_ch_radio-1; for(i=0; i<num_lines;i++) { fgets( line, 512, fp ); lines[i] = strdup(line); if ( !strstr(line,"channelNR") ) continue; p=strstr(line,"name="); copyname(l2,p+6); p=strstr(line,"channelNR="); cnum=_atoi(p+11); if ( cnum ) idx=cnum-1; p=strstr(line,"serviceType"); if ( !p || ( *(p+15) != '0' ) ) continue; switch( *(p+16) ) { case '1' : case '4' : ch=tv_ch; if ( !cnum || ch[idx].flag ) { idx=t; t--; } break; case '2' : ch=radio_ch; if ( !cnum || ch[idx].flag ) { idx=r; r--; } break; default: p=0; break; } if ( !p ) continue; ch[idx].name=strdup(l2); ch[idx].flag=*(p+14); ch[idx].line=lines[i]; } fclose(fp); t=0; while( doexit != 3 ) { if ( t ) SortBouquet( radio_ch, num_ch_radio ); else SortBouquet( tv_ch, num_ch_tv ); t=!t; switch( doexit ) { case 2 : doexit=0; break; case 1 : SaveServices(); doexit=3; break; } } for( i=0; i<num_ch_tv; i++ ) free( tv_ch[i].name ); for( i=0; i<num_ch_radio; i++ ) free( radio_ch[i].name ); for( i=0; i<num_lines; i++ ) free( lines[i] ); free( lines ); free( tv_ch ); free( radio_ch ); /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } RcClose(); FBClose(); return 0; }
int soko_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile ) { struct timeval tv; int x; if ( FBInitialize( 720, 576, 8, fdfb ) < 0 ) return -1; setup_colors(); if ( RcInitialize( fdrc ) < 0 ) return -1; Fx2ShowPig( 540, 450, 120, 90 ); ladeVerzeichnis(); Startbildschirm(); while( doexit != 3 ) { doexit=0; BoardInitialize(); #ifdef USEX FBFlushGrafic(); #endif if ( doexit == 4 ) /* fx2 - install error: no level found */ { doexit=0; while(( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); } break; } while( !doexit ) { tv.tv_sec = 0; tv.tv_usec = 10000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); MoveMouse(); } if ( doexit != 3 ) { actcode=0xee; if ( doexit ==2 ) DrawScore(); else DrawGameOver(); if (level+1 < max_level) { level++; } else { level = 0; } doexit=0; while(( actcode != RC_OK ) && !doexit ) { tv.tv_sec = 0; tv.tv_usec = 100000; x = select( 0, 0, 0, 0, &tv ); /* 100ms pause */ RcGetActCode( ); } } } Fx2StopPig(); /* fx2 */ /* buffer leeren, damit neutrino nicht rumspinnt */ realcode = RC_0; while( realcode != 0xee ) { tv.tv_sec = 0; tv.tv_usec = 300000; x = select( 0, 0, 0, 0, &tv ); /* 300ms pause */ RcGetActCode( ); } RcClose(); FBClose(); freeMem(); return 0; }