Exemple #1
0
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 );
}
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
}
Exemple #3
0
/**
 * Draws the complete board according to the values of the cells
 * and the fx logo
 *
 * Possible field values:
 * #    : inactive cell (not reachable with mouse)
 * ' '  : field which is not on the board
 * n,b,B: empty field
 * x    : cell with a tux
 * s    : selected cell with a tux 
 */
void	DrawBoard(void)
{
	int				x;
	int				y;
	unsigned char	*p = maze;

	for( y = 0; y < MAZEH; y++ )
	{
		for( x = 0; x < MAZEW; x++, p++ )
		{
			switch ( *p )
			{
			case '#' :
				FBFillRect( x*32, y*32, 32, 32, STEELBLUE );
				break;
			case ' ' :
				FBFillRect( x*32, y*32, 32, 32, BLACK );
				break;
			case 'n' :
				FBCopyImage( x*32, y*32, 32, 32, dout );
				break;
			case 'b' :
			        FBCopyImage( x*32, y*32, 32, 32, dout );
			        break;
			case 'B' :
			        FBCopyImage( x*32, y*32, 32, 32, dout );
				break;
			case 'x' :
			        FBCopyImage ( x*32, y*32, 32, 32, dtux );
			        break;
			case 's' :
			        FBCopyImage( x*32, y*32, 32, 32, dselectedtux );
			        break;
			}
		}
	}
	// draw white frame around board
	FBDrawRect( 3*32-3, 3*32-3, 9*32+5, 9*32+5, WHITE );
	FBDrawRect( 3*32-4, 3*32-4, 9*32+7, 9*32+7, WHITE );

	FBDrawString( LOGO_X-90, LOGO_Y, 32, "powered by", WHITE, 0 );
	FBDrawFx2Logo( LOGO_X, LOGO_Y );
	FBDrawString( LOGO_X-90, LOGO_Y+70, 32, 
		      "brought to you by", WHITE, 0 );
	FBDrawString( LOGO_X-80, LOGO_Y+110, 32, 
		      "ChakaZulu", WHITE, 0 );
	gettimeofday(&starttv,0);

	DrawMouse();
}
Exemple #4
0
void	DrawField( int x, int y )
{
	switch ( board[x][y] )
	{
			case '#' :									// Wand
				FBCopyImage( x*32 + ox, y*28 + oy, 32, 28, wall );
				break;
			case ' ' :									// leeres Feld
				FBCopyImage( x*32 + ox, y*28 + oy, 32, 28, empty );
				break;
			case '@' :									// Pinguin
				FBCopyImage( man_x*32 + ox, man_y*28 + oy, 32, 28, man );
				break;
			case '+' :									// Pinguin auf Zielfeld
				FBCopyImage( man_x*32 + ox, man_y*28 + oy, 32, 28, manongoal );
				break;
			case '$' :									// Kiste
				FBCopyImage( x*32 + ox, y*28 + oy, 32, 28, box );
				break;
			case '*' :									// Kiste auf Zielfeld
				FBCopyImage( x*32 + ox, y*28 + oy, 32, 28, boxongoal );
				break;
			case '.' :									// Zielfeld
				FBCopyImage( x*32 + ox, y*28 + oy, 32, 28, goal );
				break;
			case 'a' :									// äußeres Feld (nicht xsb-konform)
				if (Rand == 1)
					{
					FBCopyImage( x*32 + ox, y*28 + oy, 32, 28, test );
					}
				break;
	}
}
void	DrawPac( void )
{
	int	istep = pac.step % 10;
	int	lstep;
	int	rstep;
	int	opac_step = pac.step;

	pac.step = pac.look * 10 + istep;
	if ( pac.step > 19 )
		pac.step = opac_step;
	lstep = pac.step - istep;
	rstep = lstep + 10;
	FBCopyImage( pac.x*32+pac.x_minor, pac.y*32+pac.y_minor, 32, 32, pacs[ pac.step/2 ] );

	if ( pac.c_step ) {
		pac.step--;
		if ( pac.step < lstep ) {
			pac.step = lstep + 1;
			pac.c_step = 0;
		}
	} else {
		pac.step++;
		if ( pac.step == rstep ) {
			pac.step = rstep - 2;
			pac.c_step = 1;
		}
	}
}
void	DrawMaze( void )
{
	int		x;
	int		y;
	unsigned char	*p = maze;

	for ( y = 0; y < MAZEH; y++ ) {
		for ( x = 0; x < MAZEW; x++ ) {
			switch ( *p ) {
			case '#' :
				FBFillRect( x*32, y*32, 32, 32, STEELBLUE );
				break;
			case '.' :
				FBCopyImage( x*32, y*32, 32, 32, futter );
				break;
			case 'z' :
				FBFillRect( x*32, y*32, 32, 32, 0 );
				break;
			default :
				FBFillRect( x*32, y*32, 32, 32, BLACK );
				break;
			}
			p++;
		}
	}
	FBDrawFx2Logo( LOGO_X, LOGO_Y );
}
Exemple #7
0
static	void	killlem( int i )
{
	in_level--;
	if ( sel_sprite == i )
		sel_sprite=-1;
	lemm[i]=0;
	if ( !in_level && (( lem_run == lem_cnt ) || killall ))
	{
		if ( killall )
			FBCopyImage( 11*32+32, 384, 32, 48, svdimage[11] );
		action=3;	// level done
	}
}
Exemple #8
0
/**
 * Draws a specific cell of the board. The look depends on the content
 * of the cell which is stored in maze from pics.h.
 *
 * Possible values of a field:
 * N   : nothing
 * n,b : empty board cell
 * x   : board cell with a tux
 * s   : board cell with a tux which is selected
 *
 * @param x x-coordinate of the field to draw
 * @param y y-coordinate of the field to draw
 * @return 0
 */
static	int	DrawField( int x, int y )
{
	unsigned char	*p = maze + MAZEW * y + x;

	switch ( *p )
	{
	case 'N' :
		break;
	case 'n' :
	case 'b' :
		FBCopyImage( x*32, y*32, 32, 32, dout );
		break;
	case 'x' :
		FBCopyImage( x*32, y*32, 32, 32, dtux );
		break;

	case 's':
		FBCopyImage( x*32, y*32, 32, 32, dselectedtux );
		break;
	  
	}
	return 0;
}
Exemple #9
0
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);
}
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;
}
Exemple #11
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
	}
}
Exemple #12
0
void	RunKey( void )
{
	Sprite	*s;
	int			nac;
	int			sel_type=0;
	unsigned long	otype;

	switch( actcode )
	{
#ifdef KEY_TOPLEFT
	case KEY_TOPLEFT:
	case KEY_TOPRIGHT:
	case KEY_BOTTOMLEFT:
	case KEY_BOTTOMRIGHT:
#endif
	case RC_LEFT :
	case RC_RIGHT :
	case RC_UP :
	case RC_DOWN :
		HandleDirection ( actcode );
		break;
	case RC_RED :		// kill all lemmings
		if ( pause || (action!=2) || !in_level )
			break;
		SoundPlay( SND_OHNO );
		FBGetImage( 11*32+32, 384, 32, 48, svdimage[11] );
		FBDrawRect( 11*32+32, 384, 31, 47, RED );
		FBDrawRect( 11*32+33, 385, 29, 45, RED );
		killall=1;
		break;
	case RC_BLUE :		// PAUSE - GO
		if ( action!=2 )
			return;
		if ( pause == 1 )
			FBCopyImage( 10*32+32, 384, 32, 48, svdimage[10] );
		pause = pause ? 0 : 1;
		if ( pause )
		{
			FBGetImage( 10*32+32, 384, 32, 48, svdimage[10] );
			FBDrawRect( 10*32+32, 384, 31, 47, BLUE );
			FBDrawRect( 10*32+33, 385, 29, 45, BLUE );
		}
		break;
	case RC_1 :
	case RC_2 :
	case RC_3 :
	case RC_4 :
	case RC_5 :
	case RC_6 :
	case RC_7 :
	case RC_8 :	// select lemm-action
		if ( pause || !action || (action>2))
			break;
		nac=actcode-1;
		if ( afunc == actcode-1 )
			break;
		if ( !portfolio[ actcode-1 ] )
			break;
		FBGetImage( (nac+2)*32+32, 384, 32, 48, svdimage[nac+2] ); // save
		if ( afunc != -1 )
		{
			FBCopyImage( (afunc+2)*32+32, 384, 32, 48, svdimage[afunc+2] );
			DrawNumber( 106+afunc*32, 389, portfolio[afunc] );
		}
		FBDrawRect( (nac+2)*32+32, 384, 31, 47, YELLOW );
		FBDrawRect( (nac+2)*32+33, 385, 29, 45, YELLOW );
		afunc=nac;
		break;
	case RC_PLUS :
		if ( pause || (action!=2) )
			break;
		newspeed--;
		if ( newspeed < 1 )
			newspeed=1;
		else
		{
			DrawNumber( 74, 389, 100-newspeed );
		}
		break;
	case RC_MINUS :
		if ( pause || (action!=2) )
			break;
		newspeed++;
		if ( newspeed > minspeed )
			newspeed=minspeed;
		else
		{
			DrawNumber( 74, 389, 100-newspeed );
		}
		break;
	case RC_OK :
		if( !action )
		{
			action=1;
			s=deko[1];	// tor;
			s->anilocked=0;
			SoundPlay( SND_DOOR );
			break;
		}
		if (( action != 2 ) || pause || ( sel_sprite == -1 ) || !portfolio[afunc])
			break;
		s=lemm[ sel_sprite ];
		if ( !s )
			break;
		if ( afunc == 2 )	// EXPLODE
		{
			if ( !( s->type & TYP_EXPLODE ) )
			{
				s->type |= TYP_EXPLODE;
				s->counter1=0;
				portfolio[ afunc ]--;
				DrawNumber( 106+afunc*32, 389, portfolio[afunc] );
			}
		}
		else if ( afunc == 0 )	// CLIMB
		{
			if ( !( s->type & TYP_CLIMB ) )
			{
				s->type |= TYP_CLIMB;
				portfolio[ afunc ]--;
				DrawNumber( 106+afunc*32, 389, portfolio[afunc] );
			}
		}
		else
		{
			switch( afunc )
			{
			case 3 :
				sel_type = TYP_STOPPER;
				break;
			case 4 :
				sel_type = TYP_BUILDER;
				break;
			case 6 :
				sel_type = TYP_DIGDIAG;
				break;
			case 7 :
				sel_type = TYP_DIGDOWN;
				break;
			}
			otype=s->type & TYP_WORK;
			while( 1 )
			{
				if ( otype == sel_type )
				{
					if (( otype == TYP_BUILDER ) && ( s->counter2 > 11 ))
						break;
					sel_type = 0;
					break;
				}
				if ( !( otype & TYP_STOPPER ) && !( s->type & TYP_FALLEN ))
					break;
				sel_type = 0;
				break;
			}
			if ( sel_type )
			{
				otype = s->type;
				s->type = sel_type;
				portfolio[ afunc ]--;
				DrawNumber( 106+afunc*32, 389, portfolio[afunc] );
// erstmal die sprite-koordinaten wieder auf 0
				if (( otype & TYP_BUILDER ) && ( s->counter2 < 12 ))
				{
					s->y+=3;
				}
				else if (( otype & TYP_BUILDER ) && ( s->counter2 == 12 ))
				{
					s->y-=2;
				}
				else if ( otype & TYP_DIGDIAG )
				{
					s->y+=5;
					if ( !s->dir )
						s->x+=7;
				}
				else if ( otype & TYP_DIGDOWN )
				{
					s->y+=2;
				}
// sprite-koordinaten eventl. verschieben
				if ( sel_type == TYP_DIGDOWN )
				{
					s->y-=2;
					SpriteChangePic( s, 5 );	// lemming3
				}
				if ( sel_type == TYP_STOPPER )
				{
					s->counter1=0;
					SpriteChangePic( s, 4 );	// lemming2
					bgRect( s->x+(s->width/2), s->y, 1, s->height-2, 150 );
				}
				if ( sel_type == TYP_BUILDER )
				{
					s->counter1=0;
					s->counter2=0;
					s->y -= 3;	// 2
					SpriteChangePic( s, 31 );	// builder
					if ( s->dir )
					{
						s->x++;
						MirrorSprite( s );
					}
					else
						s->x--;
				}
				if ( sel_type == TYP_DIGDIAG )
				{
					s->counter1=0;
					s->counter2=0;
					s->y -= 5;
					SpriteChangePic( s, 33 );	// hacke
					if ( s->dir )
					{
						MirrorSprite( s );
					}
					else
						s->x-=7;
				}
			}
		}
		break;
	}
}
Exemple #13
0
void	RunLemm( void )
{
static	int		counter1=0;
static	int		blinkc=0;
	int			i;
	int			f;
	int			b;
	Sprite		*s;
	int			cursor_get=0;
	int			kab=0;
	int			hbk=0;	// hat boden kontakt
//int			hhy=0;

	blinkc++;

	if ( action==3 )
	{
		counter1=0;
		action=4;
		DrawSprite( deko[0] );
		return;
	}
	if ( action==4 )
	{
		counter1++;
		if ( counter1 < 24 )
			return;

		if ( to_rescue > lem_in )
		{
			FBDrawString( 252, 142, 64, "You lost !", WHITE, 0 );
			FBDrawString( 250, 140, 64, "You lost !", RED, 0 );
		}
		else
		{
			level++;
			if ( level>LASTLEVEL )
			{
				FBDrawString( 252, 142, 64, "all level solved", WHITE, 0 );
				FBDrawString( 250, 140, 64, "all level solved", GREEN, 0 );
				FBDrawString( 240, 250, 36, "thanx to emuman for his javacode,", WHITE, 0 );
				FBDrawString( 240, 286, 36, "Psygnosis and DMA for artwork...", WHITE, 0 );
				level=1;
				doexit=2;
				return;
			}
			else
			{
				FBDrawString( 252, 142, 64, "Level solved", WHITE, 0 );
				FBDrawString( 250, 140, 64, "Level solved", GREEN, 0 );
			}
		}
		if ( afunc != -1 )
			FBCopyImage( (afunc+2)*32+32, 384, 32, 48, svdimage[afunc+2] );
		action=5;
		doexit=1;
	}

	if ( action != 2 )
	{
		DrawSprite( deko[0] );
		return;
	}
	if ( pause )
	{
		UndrawSprite( deko[0] );
		for( i=0; i<lem_run; i++ )
		{
			if ( !lemm[i] )
				continue;
			UndrawSprite( lemm[i] );
		}
		DrawSprite( deko[1] );		// ziel
		DrawSprite( deko[2] );		// ziel
		for( i=0; i<lem_run; i++ )
		{
			if ( !lemm[i] )
				continue;
			s=lemm[i];
			if (( s->type & TYP_EXPLODE ) && ( s->countdown > 0 ))
			{
				DrawSimpleNumber( s->x-main_x, s->y-6, s->countdown, 1 );
			}
			SpriteGetBackground( s );
			DrawSprite( s );
		}
		SpriteSelPic( deko[0], 0 );
		SpriteGetBackground( deko[0] );
		DrawSprite( deko[0] );

		if ( blinkc%5 )
			return;
		if ( pause == 1 )
		{
			FBCopyImage( 10*32+32, 384, 32, 48, svdimage[10] );
			pause=2;
		}
		else
		{
			FBDrawRect( 10*32+32, 384, 31, 47, BLUE );
			FBDrawRect( 10*32+33, 385, 29, 45, BLUE );
			pause=1;
		}
		return;
	}

	sel_sprite=-1;

	if (( lem_run < lem_cnt ) && !( counter1%((newspeed/2)+3) ) && !killall )
	{
		lemm[ lem_run ] = CreateSprite(3,0,deko[1]->x+19,deko[1]->y);
		lemm[ lem_run ]->dir=0;		// rechts
		lemm[ lem_run ]->type = TYP_WALKER;

		in_level++;
		lem_run++;
		DrawInfo(1);
	}
	if ( in_level )
		UndrawSprite( deko[0] );
	for( i=0; i<lem_run; i++ )
	{
		if ( !lemm[i] )
			continue;
		s=lemm[i];
		if ( s->type & TYP_EXPLODE )
			restorecd( i );
		else if (( s->type & TYP_FALLEN ) && s->partikel )
			restorecd( i );
		UndrawSprite( s );
		s->counter1++;
		if ( !( s->counter1 % 10 ) && ( s->type & TYP_EXPLODE ) )
		{
			s->countdown--;
			if ( s->countdown == -1 )
			{
				s->counter1=0;
				bg2CopyImage( s->x-7, s->y-4, 21, 21, pbomb );
				CopyBg2Screen( s->x-7,s->y-4, 21, 21);
			}
		}
		if (( s->counter1 == 2 ) && ( s->type & TYP_STOPPER ) &&
			!( s->type & TYP_EXPLODE ))
			bgRect( s->x+1, s->y, s->width-1, s->height-2, 150 );
	}
//	DrawSprite( deko[2] );		// ziel
	UnanimatedDeko();
	for( i=0; i<lem_run; i++ )
	{
		if ( !lemm[i] )
			continue;

		s=lemm[i];

		if ( killall && !kab )
		{
			if ( !(s->type & TYP_EXPLODE ) )
			{
				s->type |= TYP_EXPLODE;
				s->counter1=1;
				kab++;
			}
		}

		if ( (s->countdown==-1) && ( s->type & TYP_EXPLODE ) )
		{
			s->partikel=1;
			partikel(i,1);
		}
		if ( !( s->counter1 % 10 ) && ( s->type & TYP_EXPLODE ) )
		{
			if ( s->countdown == -1 )
			{
				s->y-=4;
				s->x-=4;
				SpriteChangePic( s, 8 );		// explosion
				SpriteGetBackground( s );
				DrawSprite(s);
				SoundPlay( SND_EXPLODE );
			}
			if ( s->countdown == -2 )
			{
				partikel(i,0);
				killlem( i );
				s=0;
				DrawInfo(1);
			}
		}

		if ( s && ( s->countdown < 0 ))
			s=0;

		if ( s && ( s->type & TYP_FALLEN ) )
		{
			if ( s->counter1 < 10 )
			{
				s->partikel=1;
				partikel(i,1);
			}
			else
			{
				killlem( i );
				DrawInfo(1);
			}
			s=0;
		}

		if ( s&&(s->countdown>0) )
		{
			SpriteNextPic( s );
			if ( s->type&TYP_ATHOME )
			{
				s->y-=1;
				if(s->ani==4)
				{
					lem_in++;
					killlem(i);
					SoundPlay( SND_OING );
					DrawInfo(3);
				}
			}
			else
			{	/* lemming im ziel ? */
				if((s->x==haus_x)&&(s->y>haus_y1)&&
					(s->y<haus_y2))
				{
					s->type=TYP_ATHOME;
					s->counter2=0;
					SpriteChangePic( s, 6 );	// lemming4
				}
				else
				{	/* kein bodenkontakt ? */
					switch( s->type & TYP_WORK )
					{
					case TYP_WALKER :
					case TYP_DIGDOWN :
						hbk=isBrick(s->x+1,s->y+s->height,0)||
								isBrick(s->x-2+s->width,s->y+s->height,0);
						break;
					case TYP_STOPPER :
						hbk=isBrick(s->x+1,s->y+s->height+1,0)||
								isBrick(s->x-2+s->width,s->y+s->height+1,0);
						break;
					case TYP_DIGDIAG :
						hbk=isBrick(s->x+10,s->y+s->height-2,0)||
								isBrick(s->x+11,s->y+s->height-2,0);
						break;
					case TYP_BUILDER :
						hbk=1;
						break;
					}
					if ( !hbk )
					{
#if 0
if ( s->type & TYP_DIGDIAG )
{
hhy=s->y+s->height-2;
printf("kein boden on %d, %d\n",s->x,s->y+s->height);
}
#endif
						if( !( s->type&TYP_WALKER ) )
						{
							switch( s->type & TYP_WORK )
							{
							case TYP_STOPPER :
								bgRect(s->x+1,s->y,s->width-1,s->height-2,14);
								break;
							case TYP_DIGDIAG :
								s->y+=5;
								if ( !s->dir )
									s->x+=7;
								break;
							case TYP_DIGDOWN :
								s->y+=2;
								break;
							}
							s->type=TYP_WALKER|(s->type&TYP_UTILS);
							SpriteChangePic( s, 3 );	// lemming1-faller
							if ( s->dir )
								MirrorSprite( s );
						}
						// freier fall
						s->y += 2;
						s->counter2++;
						// aus bild gefallen
						if(s->y>=160)
						{
							SoundPlay( SND_DIE );
							killlem(i);
							DrawInfo(1);
						}
					}
					else
					{
						if(s->type&TYP_WALKER)
						{	/* aufgeschlagen */
							if(s->counter2>=40)
							{
								s->counter1=0;
								s->type=TYP_FALLEN;
								SoundPlay( SND_DIE );
								s->partikel=1;
								partikel(i,1);
								s=0;
							}
							else
							{	/* wieder auf boden */
								s->counter2=0;
								/* laeufer - getestet wird oben */
								if((isBrick(s->x,s->y+1,1)&&
									(s->dir==1))||
								   (isBrick(s->x+s->width,s->y+1,1)&&
									(s->dir==0)))
								{
									MirrorSprite( s );
									s->dir^=1;
								}
								else
								{
									s->x += (s->dir?-1:1);
									if ( s->dir )
									{
										for(b=8;b>0;b--)
										{
											if(isBrick(s->x,
												s->y+s->height-b,0))
											{
												s->y-=1;
												b=0;
											}
										}
									}
									else
									{
										for(b=8;b>0;b--)
										{
											if(isBrick(s->x+s->width,
												s->y+s->height-b,0))
											{
												s->y-=1;
												b=0;
											}
										}
									}
								}
							} /* else, kein matsch */
						} /** walker **/
						else if(s&&(s->type&TYP_BUILDER))
						{
							unsigned char	c=118;	// stair
							if ( !s->ani )
							{
								s->counter2++;
								s->y--;
								if ( s->counter2 != 13 )
								{
									if ( s->dir )
									{
										s->x-=2;
										bghLine(s->x+2,s->y+s->height,6,&c,1);
										CopyBg2Screen( s->x+2,s->y+s->height,6,1);
										if ( isBrick(s->x+1,s->y+2,1) )
										{
											s->y+=2;
											s->dir=0;
											s->counter2=13;
										}
									}
									else
									{
										s->x+=2;
										bghLine(s->x+1,s->y+s->height,6,&c,1);
										CopyBg2Screen( s->x+1,s->y+s->height,6,1);
										if ( isBrick(s->x+s->width,s->y+2,1) )
										{
											s->y+=2;
											s->dir=1;
											s->counter2=13;
										}
									}
								}
								if ( s->counter2 == 12 )
								{
									s->y+=2;
									SpriteChangePic( s, 32 );//keinesteine
									if ( s->dir )
										MirrorSprite( s );
								}
								if ( s->counter2 == 13 )
								{
									s->type&=TYP_UTILS;
									s->type|=TYP_WALKER;
									SpriteChangePic( s, 3 );// lemming1
									if ( s->dir )
										MirrorSprite( s );
								}
							}
						}
						else if(s&&(s->type&TYP_DIGDOWN))
						{
							if(!(s->counter1%8))
							{
								if(s->y<160)
								{
									bgRect( s->x+1, s->y+4, 10,
										8-max(0,s->y-152), STEELBLUE );
									s->y+=1;
									cursor_get=1;
								}
							}
						}	/* digger */
						else if(s&&(s->type&TYP_DIGDIAG))
						{
							if ( s->ani == 8 )
							{
								if ( s->dir )
								{
									unsigned char *data = GetMirrorPic(34);
									bg2CopyImage(s->x+1,s->y+2,6,14,data);
								}
								else
								{
									inBg(34,0,s->x+11,s->y+2);
								}
							}
							if ( !s->ani )
							{
								s->y+=1;
								if ( s->dir )
									s->x-=2;
								else
									s->x+=2;
							}
						}
					}	/* freier fall */
				}	/* nicht am ziel */
			}	/* countdown */
			if ( s&&(level==5) )
			{ /* ab ins feuer ? */
				for( f=5; f<11; f++ )
				{
					if ( SpriteCollide( deko[f], s->x+s->width, s->y ) )
					{
						SoundPlay( SND_DIE );
						killlem(i);
						s=0;
						break;
					}
				}
			}
		}	/* typ-fallen */

		if ( !lemm[i] || !s )
			continue;

		if (( s->type & TYP_EXPLODE ) && ( s->countdown > 0 ))
		{
			DrawSimpleNumber( s->x-main_x, s->y-6, s->countdown, 1 );
		}

		SpriteGetBackground( s );
		DrawSprite( s );
		if ( SpriteCollide( s, deko[0]->x+7, deko[0]->y+7 ) )
		{
			sel_sprite=i;
		}
	}
	if ( cursor_get )
		SpriteGetBackground( deko[0] );
	if ( sel_sprite != -1 )
	{
		SpriteSelPic( deko[0], 1 );
	}
	else
	{
		SpriteSelPic( deko[0], 0 );
	}
	DrawSprite( deko[0] );
#if 0
if ( hhy )
FBDrawLine(32,hhy+hhy+32,656,hhy+hhy+32,RED);
#endif
	counter1++;
}
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;

}