void NumbersHolder::PrintNumberCoins(Dim num) {
	Dim first = num / 10;
	Dim second = num % 10;

	SuspendNumbers(c1, coin1);
	SuspendNumbers(c2, coin2);
	
	coin1 = DisplayNumber(first, 110);
	coin2 = DisplayNumber(second, 118);

	c1 = first;
	c2 = second;
}
示例#2
0
int main (void)
{
  unsigned long tmp;
  tmp = (ReadNumber() & 0x0ff0L) >> 4;
  DisplayNumber (tmp);
  return 0;
}
void NumbersHolder::PrintNumberTime(Dim num) {
	Dim first = num / 100;
	Dim second = (num % 100) / 10;
	Dim third = num % 10;
	
	SuspendNumbers(t1, time1);
	SuspendNumbers(t2, time2);
	SuspendNumbers(t3, time3);
	if(num == 0)
			return ;
	time1 = DisplayNumber(first, 215);
	time2 = DisplayNumber(second, 223);
	time3 = DisplayNumber(third, 231);

	t1 = first;
	t2 = second;
	t3 = third;
}
void NumbersHolder::PrintScore(Dim num) {
	Dim first = num / 100000;
	Dim second = (num % 100000) / 10000;
	Dim third = (num % 10000) / 1000;
	Dim fourth = (num % 1000) / 100;
	Dim fifth = (num % 100) / 10;
	Dim sixth = num % 10;

	SuspendNumbers(sc1, score1);
	SuspendNumbers(sc2, score2);
	SuspendNumbers(sc3, score3);
	SuspendNumbers(sc4, score4);
	SuspendNumbers(sc5, score5);
	SuspendNumbers(sc6, score6);

	score1 = DisplayNumber(first, 20);
	score2 = DisplayNumber(second, 28);
	score3 = DisplayNumber(third, 36);
	score4 = DisplayNumber(fourth, 44);
	score5 = DisplayNumber(fifth, 52);
	score6 = DisplayNumber(sixth, 60);

	sc1 = first;
	sc2 = second;
	sc3 = third;
	sc4 = fourth;
	sc5 = fifth;
	sc6 = sixth;

}
示例#5
0
文件: main.c 项目: aprilpaoyin/Lab-6
int main()
{	
	
	ConfigPins();
	int i=5000;	
	while(1) 
	{
	
		DisplayNumber(i--);
		RefreshDisplay();
		if (i < 0)
			i=5000;
		
	}    
}
void QmitkNumberPropertySlider::setDecimalPlaces(short places)
{
  switch (m_DataType)
  {
    case DT_FLOAT:
    case DT_DOUBLE:
      {
        adjustFactors( places, m_ShowPercents );
        DisplayNumber();
        break;
      }
    default:
      break;
  }
}
void QmitkNumberPropertyView::setDecimalPlaces(short places)
{
  m_DecimalPlaces = places;
  
//  if (m_DecimalPlaces >= 0)
//  {
//    m_FormatString = "%%.%if";  
//    m_FormatString.sprintf(QString(m_FormatString), m_DecimalPlaces); // do copy before sprintf
//  }
//  else
//  {
//    m_FormatString = "%g";  
//  }
  
  DisplayNumber();
}
示例#8
0
// ****************************************************************************
//
//  Function Name:	RNumberDialog::OnInitDialog
//
//  Description:		dialog Numberization.
//
//  Returns:			void
//
//  Exceptions:		None
//
// ****************************************************************************
BOOL RNumberDialog::OnInitDialog()
{
    m_rHeadlineText =  ::GetResourceManager().GetResourceString( IDS_DEFAULT_NUMBER );

    if( !RInitCapDialog::OnInitDialog() ) return FALSE;

    m_cHeadlineEditCtrl.SetLimitText( kMaxNumNumbers );

    // Display the number
    DisplayNumber();
    ApplyHeadlineEffect();

    m_fInitializing = FALSE;
    UpdatePreview();
    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
示例#9
0
uint8_t doDemo(uint8_t num)
{
  uint8_t retVal;
  switch(num)
  {
  case 1: // Normal function, Eink Logo ON, Power Icon ON
    DisplayNumber (&dispNum,2,TYPE_NUM, displayScreen);     // Clear all previous segments turned ON and Turn ON first ICON
    DisplayNumber (&dispNum,1,TYPE_NUM|FORMAT_RETAIN_OTHER, displayScreen);  // Turn ON second ICON making sure that first ICON is retained
    if(updateRequest==FALSE)
      updateRequest=TRUE;
    retVal = 0;
    
    break;
  case 2: // Halt state, Eink Logo ON, Moon Icon ON
    DisplayNumber (&dispNum,2,TYPE_NUM, displayScreen);
    DisplayNumber (&dispNum,5,TYPE_NUM|FORMAT_RETAIN_OTHER, displayScreen); 
    if(updateRequest==FALSE)
      updateRequest=TRUE;
    
    break;
  case 3: // Snooze state, Eink Logo ON, Clock Icon ON
    DisplayNumber (&dispNum,2,TYPE_NUM, displayScreen);
    DisplayNumber (&dispNum,3,TYPE_NUM|FORMAT_RETAIN_OTHER, displayScreen); 
    if(updateRequest==FALSE)
      updateRequest=TRUE;

    break;
  case 4: // Stop state, Eink Logo ON, Hand Icon ON
    DisplayNumber (&dispNum,2,TYPE_NUM, displayScreen);
    DisplayNumber (&dispNum,4,TYPE_NUM|FORMAT_RETAIN_OTHER, displayScreen); 
    if(updateRequest==FALSE)
      updateRequest=TRUE;
    
    retVal = 1;
    break;
  case 5: // Super cap
    break;
    
  default:
    break;
  }
  return retVal;
}
示例#10
0
/******************Ö÷³ÌÐò********************************/
void main(void)
{
   Pin_Init();
   T0_Init();
   Uart1_Init();
   Uart2_Init();
   Uart1_AppInit();
   Uart2_AppInit();
   MdTcbInit1();
   MdTcbInit2();
   Global_EI();
   while (1)
   {
      TimeDeal(&Ahu1);
      MdPoll01();
      MdPoll02();
      if (Ahu1.Times.Solo._1msFlag)
      {
         UartTimeOut(&UartAppData1);
         UartTimeOut(&UartAppData2);
	 KeyScanDeal(KeyGet());
	 KeyAllStateDeal(&Ahu1);
	 NumberDisplayScan(&Ahu1);
      }
      DisplayNumber(flag);
      if (Ahu1.Times.Solo._5msFlag)
      {
	 LedOutputScan(&Ahu1);
	 RhDisplayScan(&Ahu1);    
	 TmepDisplayScan(&Ahu1);  
      }
      if (Ahu1.Times.Solo._10msFlag)
      {


      }
      if (Ahu1.Times.Solo._1000msFlag)
      {
	 flag++;
      }
//      Ahu1.Humidity.Solo.SEG_B = 1;
//      Ahu1.Temperature.Solo.SEG_C = 1;
      Ahu1.Times.All[0] = 0;
   }
}
void QmitkNumberPropertySlider::setShowPercent(bool showPercent)
{
  if ( showPercent == m_ShowPercents ) return; // nothing to change

  switch (m_DataType)
  {
    case DT_FLOAT:
    case DT_DOUBLE:
    {
      adjustFactors( m_DecimalPlaces, showPercent );
      break;
    }
    default:
    {
      break;
    }
  }

  DisplayNumber();
}
void QmitkNumberPropertyEditor::initialize()
{   // only to be called from constructors

    // spinbox settings
    //setValidator(0);
    setSuffix("");

    // protected
    m_DecimalPlaces = 0;
    m_FactorPropertyToSpinbox = 1.0;
    m_FactorSpinboxToDisplay = 1.0;
    m_ShowPercents = false;

    // private
    m_SelfChangeLock = false;

    connect( this, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)) );

    // display current value of our property
    DisplayNumber();
}
void QmitkNumberPropertySlider::PropertyChanged()
{
  DisplayNumber();
  mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
示例#14
0
// ****************************************************************************
//
//  Function Name:	RNumberDialog::OnButtonNumberSmartNumber
//
//  Description:		User clicksd smart number checkbox.
//
//  Returns:			void
//
//  Exceptions:		None
//
// ****************************************************************************
void RNumberDialog::OnButtonNumberSmartNumber()
{
    m_fSmartNumber = !m_fSmartNumber;
    DisplayNumber();
}
示例#15
0
void setLogo(int logo) {
	DisplayNumber (&dispNum,logo,TYPE_NUM, displayScreen);
	updateRequest=TRUE;
}
示例#16
0
//
// Takes a digit and a number, and displays the number at the
// specified digit on the 7-segment display
//
void DisplayTime(int digit, int number)
{
    DisplayDigit(digit);
    DisplayNumber(number);
}
示例#17
0
void QmitkNumberPropertyView::PropertyChanged()
{
  if ( m_Property )
    DisplayNumber();
}
示例#18
0
void QmitkNumberPropertyView::setSuffix(const QString& suffix)
{
  m_Suffix = suffix;

  DisplayNumber();
}
示例#19
0
void clearLogo(int logo) {
	DisplayNumber (&dispNum,logo,TYPE_NUM|FORMAT_RETAIN_OTHER, displayScreen);
	updateRequest=TRUE;
}
示例#20
0
// ****************************************************************************
//
//  Function Name:	RNumberDialog::OnEditChangeHeadlineText
//
//  Description:		Number text is changing, reset timer.
//
//  Returns:			void
//
//  Exceptions:		None
//
// ****************************************************************************
void RNumberDialog::OnEditChangeHeadlineText()
{
    DisplayNumber();
}
void SelectSong(void)
{
	DWORD count,i;
	static DWORD current;
	static DWORD SelectCurrent;
	static int Selected, zoom,toggle,speed;

	RECT	lRect;
	int ModeTemp1p, ModeTemp2p;
	
	static	time_t t;
	
	static	int a,b,c;

	static	int iMove;

	RECT DiscSize,Screen;

	char s[50];

	if(First==0)
	{
		startTimer=timeGetTime();
		if(Start1p==FALSE)
		{
			HighSpeed1p=1;
			bModeMirror1p=FALSE;
			bModeNonstep1p=FALSE;
			bModeSynchro=FALSE;
			bModeUnion1p=FALSE;
			bModeRandom1p=FALSE;
			b4dMix1p=FALSE;
				HighSpeed1p_1=1;
				HighSpeed1p_3=1;
				HighSpeed1p_5=1;
				HighSpeed1p_7=1;
				HighSpeed1p_9=1;
			bModeVanish1p=FALSE;
			bModeSuddenR1p=FALSE;
			bModeRandomS1p=FALSE;

		}
		if(Start2p==FALSE)
		{
			HighSpeed2p=1;
			bModeMirror2p=FALSE;
			bModeNonstep2p=FALSE;
			bModeUnion2p=FALSE;
			bModeRandom2p=FALSE;
			b4dMix2p=FALSE;
				HighSpeed2p_1=1;
				HighSpeed2p_3=1;
				HighSpeed2p_5=1;
				HighSpeed2p_7=1;
				HighSpeed2p_9=1;
			bModeVanish2p=FALSE;
			bModeSuddenR1p=FALSE;
			bModeRandomS1p=FALSE;
		}
		DDFillSurface(g_pDDSPrimary,0);
		DDFillSurface(g_pDDSBack,0);
		
		//FadeToSurface(SelectBack);
		g_pDDSBack->BltFast(0,0, SelectBack, NULL, DDBLTFAST_NOCOLORKEY);
		
		a=Start1p;b=Start2p;
		First++;

		if(g_dsSelectSong)g_dsSelectSong->Play(0,0,DSBPLAY_LOOPING);
	}

	DiscSize.top=0;
	DiscSize.left=0;
	DiscSize.right=300;
	DiscSize.bottom=200;

	for(count=0;;count++)
	{
		if(count!=0)CSONG[count].Prev=count-1;
		
		CSONG[count].Next=count+1;
		
		if(CSONG[count].bpm==0)
		{
			CSONG[count].Prev=0;
			count--;
			CSONG[count].Next=0;
			CSONG[0].Prev=count;
			break;
		}
	}

	if(speed==1) //일단은 변수를 이용합니다. 곧 타이머 형식으로 바꾸도록 합시다. 
	{
		speed=0;
		if(toggle==0)
		{
			if(zoom==10)toggle=1;
			else zoom++;
		}
		else if(toggle==1)
		{
			if(zoom==0)toggle=0;
			else zoom--;
		}
	}
	else speed++; 

	ReadGameInput();

	if(PressedKey1p[5]==TRUE)
	{
		if(Start1p==FALSE)
		{
			Start1p=TRUE;
		}
	}
	if(PressedKey2p[5]==TRUE)
	{
		if(Start2p==FALSE)
		{
			Start2p=TRUE;
		}
	}

	ModeTemp1p=ScanHiddenMode1p();

	if(ModeTemp1p)if(IntroFlag){intro->OnMediaStop();delete intro;IntroFlag=FALSE;}

	switch(ModeTemp1p)
	{
		case HMODE_SUDDENR:
			bModeSuddenR1p=TRUE;
			bModeVanish1p=FALSE;

			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_RANDOMS:
			bModeRandomS1p=TRUE;
			HighSpeed1p=1;

			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_2X:
			HighSpeed1p=2;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_4X:
			HighSpeed1p=4;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_8X:
			HighSpeed1p=8;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_MIRROR:
			bModeMirror1p=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_NONSTEP:
			bModeNonstep1p=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_SYNCHRO:
			bModeSynchro=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_UNION:
			bModeUnion1p=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_RANDOM:
			bModeRandom1p=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_4DMIX:
			srand((unsigned) time(&t));

			HighSpeed1p_1=1+rand()%8;
			HighSpeed1p_3=1+rand()%8;
			HighSpeed1p_5=1+rand()%8;
			HighSpeed1p_7=1+rand()%8;
			HighSpeed1p_9=1+rand()%8;

			b4dMix1p=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_VANISH:
			bModeVanish1p=TRUE;
			bModeSuddenR2p=FALSE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
/*		case HMODE_NONSTOPDOUBLE:
			if(Start1p&&Start2p)break;
			Double=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;*/
		case HMODE_CANCEL:
			if(g_dsCancel)g_dsCancel->Play(0,0,0);
			HighSpeed1p=1;
			bModeMirror1p=FALSE;
			bModeNonstep1p=FALSE;
			bModeSynchro=FALSE;
			bModeUnion1p=FALSE;
			bModeRandom1p=FALSE;
			b4dMix1p=FALSE;
				HighSpeed1p_1=1;
				HighSpeed1p_3=1;
				HighSpeed1p_5=1;
				HighSpeed1p_7=1;
				HighSpeed1p_9=1;
			bModeVanish1p=FALSE;
			bModeSuddenR1p=FALSE;
			bModeRandomS1p=FALSE;
			Double=FALSE;
			break;
	}

	ModeTemp2p=ScanHiddenMode2p();
	if(ModeTemp2p)if(IntroFlag){intro->OnMediaStop();delete intro;IntroFlag=FALSE;}
	
	switch(ModeTemp2p)
	{
		case HMODE_SUDDENR:
			bModeSuddenR2p=TRUE;
			bModeVanish2p=FALSE;

			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_RANDOMS:
			bModeRandomS2p=TRUE;
			HighSpeed2p=1;

			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_2X:
			HighSpeed2p=2;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_4X:
			HighSpeed2p=4;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_8X:
			HighSpeed2p=8;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_MIRROR:
			bModeMirror2p=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_NONSTEP:
			bModeNonstep2p=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_SYNCHRO:
			bModeSynchro=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_UNION:
			bModeUnion2p=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_RANDOM:
			bModeRandom2p=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_4DMIX:

			srand((unsigned) time(&t));

			HighSpeed2p_1=1+rand()%8;
			HighSpeed2p_3=1+rand()%8;
			HighSpeed2p_5=1+rand()%8;
			HighSpeed2p_7=1+rand()%8;
			HighSpeed2p_9=1+rand()%8;

			b4dMix2p=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
		case HMODE_VANISH:
			bModeVanish2p=TRUE;
			bModeSuddenR2p=FALSE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
			break;
/*		case HMODE_NONSTOPDOUBLE:
			if(Start1p&&Start2p)break;
			Double=TRUE;
			if(g_dsMode){g_dsMode->Stop();g_dsMode->SetCurrentPosition(0);g_dsMode->Play(0,0,0);}
*/			break;

		case HMODE_CANCEL:
			if(g_dsCancel)g_dsCancel->Play(0,0,0);
			HighSpeed2p=1;
			bModeMirror2p=FALSE;
			bModeNonstep2p=FALSE;
			bModeUnion2p=FALSE;
			bModeRandom2p=FALSE;
			b4dMix2p=FALSE;
				HighSpeed2p_1=1;
				HighSpeed2p_3=1;
				HighSpeed2p_5=1;
				HighSpeed2p_7=1;
				HighSpeed2p_9=1;
			bModeVanish2p=FALSE;
			bModeSuddenR2p=FALSE;
			bModeRandomS2p=FALSE;
			Double=FALSE;
			break;
	}

	if((Start1p && PressedKey1p[1]) || (Start2p && PressedKey2p[1]))
	{
		if(IntroFlag){intro->OnMediaStop();delete intro;IntroFlag=FALSE;}
		if(g_dsMove){g_dsMove->Stop();g_dsMove->SetCurrentPosition(0);g_dsMove->Play(0,0,0);}

		Selected=0;

		iMove=1;
		current=CSONG[CSONG[current].Prev].Prev;
	}

	if((Start1p && PressedKey1p[3]) || (Start2p && PressedKey2p[3]))
	{
		if(IntroFlag){intro->OnMediaStop();delete intro;IntroFlag=FALSE;}
		if(g_dsMove){g_dsMove->Stop();g_dsMove->SetCurrentPosition(0);g_dsMove->Play(0,0,0);}

		Selected=0;

		iMove=-1;
		current=CSONG[CSONG[current].Next].Next;
	}
	
	if((Start1p && PressedKey1p[7]) || (Start2p && PressedKey2p[7]))
	{
		if(Selected==7)
		{
			SelectCurrent=current;
			PressedKey1p[0]=3;
		}
		else
		{
			if(IntroFlag){intro->OnMediaStop();delete intro;IntroFlag=FALSE;}
			if(g_dsMove){g_dsMove->Stop();g_dsMove->SetCurrentPosition(0);g_dsMove->Play(0,0,0);}
/*			if(CSONG[current].Int_Song)
			{
				if(g_dsSelectSong)g_dsSelectSong->Stop();
				g_Cur_Song=CSONG[current].Int_Song;
				g_Cur_Song->SetCurrentPosition(0);
				g_Cur_Song->Play(0,0,0);
			}
			else*/ if(access(CSONG[current].WavsName,04)==0)
			{
				IntroFlag=TRUE;
				intro= new CMedia;
				intro->OpenMediaFile(CSONG[current].WavsName);
				intro->OnMediaPlay();
			}
			else if(access(CSONG[current].Wavs3Name,04)==0)
			{
				IntroFlag=TRUE;
				intro= new CMedia;
				intro->OpenMediaFile(CSONG[current].Wavs3Name);
				intro->OnMediaPlay();
			}

			Selected=7;
		}
	}
	
	if((Start1p && PressedKey1p[9]) || (Start2p && PressedKey2p[9]))
	{
		if(Selected==9)
		{
			SelectCurrent=CSONG[current].Next;
			PressedKey1p[0]=3;
		}
		else
		{
			if(IntroFlag){intro->OnMediaStop();delete intro;IntroFlag=FALSE;}
			if(g_dsMove){g_dsMove->Stop();g_dsMove->SetCurrentPosition(0);g_dsMove->Play(0,0,0);}
/*			if(CSONG[CSONG[current].Next].Int_Song)
			{
				if(g_dsSelectSong)g_dsSelectSong->Stop();
				g_Cur_Song=CSONG[CSONG[current].Next].Int_Song;
				g_Cur_Song->SetCurrentPosition(0);
				g_Cur_Song->Play(0,0,0);
			}
			else */if(access(CSONG[CSONG[current].Next].WavsName,04)==0)
			{
				IntroFlag=TRUE;
				intro= new CMedia;
				intro->OpenMediaFile(CSONG[CSONG[current].Next].WavsName);
				intro->OnMediaPlay();
			}
			else if(access(CSONG[CSONG[current].Next].Wavs3Name,04)==0)
			{
				IntroFlag=TRUE;
				intro= new CMedia;
				intro->OpenMediaFile(CSONG[CSONG[current].Next].Wavs3Name);
				intro->OnMediaPlay();
			}

			Selected=9;
		}
	}

	if(PressedKey1p[0]==3)
	{
		PressedKey1p[0]=0;

		if(CSONG[SelectCurrent].HaveCrazy==TRUE)GameMode=MODE_CRAZY,Double=FALSE;
	   	else if(CSONG[SelectCurrent].HaveDouble==TRUE)GameMode=MODE_DOUBLE,Double=TRUE;
	   	else if(CSONG[SelectCurrent].HaveEasy==TRUE)GameMode=MODE_EASY,Double=FALSE;
	   	else if(CSONG[SelectCurrent].HaveHard==TRUE)GameMode=MODE_HARD,Double=FALSE;
		else return;

		if(Start1p && Start2p)
		{
			Couple=TRUE;
			if(CSONG[SelectCurrent].HaveCouple==FALSE)bModeSynchro=TRUE;
		} else Couple=FALSE;

		if(SongBack)
		{
			SongBack->Release();
			SongBack=NULL;
		}
		
		if(g_dsCancel)
		{
			g_dsCancel->Stop();
			g_dsCancel->Play(0,0,0);
		}

		if(SongTitle)
		{
			SongTitle->Release();
			SongTitle=NULL;
		}
		SongTitle = DDLoadBitmap(g_pDD,CSONG[SelectCurrent].TitlePath,0,0);
		SongBack = DDLoadBitmap(g_pDD,CSONG[SelectCurrent].BMPPath,0,0);
		if(SongBack == NULL)
		{
			if(SongTitle)SongBack=DDLoadBitmap(g_pDD,CSONG[SelectCurrent].TitlePath,0,0);
			else SongBack=DDLoadBitmap(g_pDD, "Images\\Back.bmp",0,0);
		}
		if(SongTitle == NULL)
		{
			SongTitle=DDLoadBitmap(g_pDD,"Images\\NoTitle.bmp",0,0);
			if(SongTitle)g_pDDSPrimary->BltFast(0,0,SongTitle,NULL,DDBLTFAST_NOCOLORKEY);
		}
		else g_pDDSPrimary->BltFast(0,0,SongTitle,NULL,DDBLTFAST_NOCOLORKEY);

		if(GameMode == MODE_DOUBLE)
		{
			memcpy(&Data_Double,&CSONG[SelectCurrent].Data_Double,sizeof(CSONG[SelectCurrent].Data_Double));
		}
		else if(Couple==TRUE)
		{
			switch(GameMode)
			{
				case MODE_CRAZY:
					if(bModeSynchro)
					{
						memcpy(&Data,&CSONG[SelectCurrent].Data_Crazy,sizeof(CSONG[SelectCurrent].Data_Crazy));
						memcpy(&Data1,&CSONG[SelectCurrent].Data_Crazy,sizeof(CSONG[SelectCurrent].Data_Crazy));

						for(i=0;i<MAX_DATA;i++)
						{
							Data1[i][5]=Data1[i][0];
							Data1[i][6]=Data1[i][1];
							Data1[i][7]=Data1[i][2];
							Data1[i][8]=Data1[i][3];
							Data1[i][9]=Data1[i][4];
						}
					}
					else
					{
						memcpy(&Data,&CSONG[SelectCurrent].Data_Crazy1,sizeof(CSONG[SelectCurrent].Data_Crazy1));
						memcpy(&Data1,&CSONG[SelectCurrent].Data_Crazy1,sizeof(CSONG[SelectCurrent].Data_Crazy1));
					}
					break;
				case MODE_EASY:
					if(bModeSynchro)
					{
						memcpy(&Data,&CSONG[SelectCurrent].Data_Easy,sizeof(CSONG[SelectCurrent].Data_Easy));
						memcpy(&Data1,&CSONG[SelectCurrent].Data_Easy,sizeof(CSONG[SelectCurrent].Data_Easy));
						
						for(i=0;i<MAX_DATA;i++)
						{
							Data1[i][5]=Data1[i][0];
							Data1[i][6]=Data1[i][1];
							Data1[i][7]=Data1[i][2];
							Data1[i][8]=Data1[i][3];
							Data1[i][9]=Data1[i][4];
						}
					}
					else
					{
						memcpy(&Data,&CSONG[SelectCurrent].Data_Easy1,sizeof(CSONG[SelectCurrent].Data_Easy1));
						memcpy(&Data1,&CSONG[SelectCurrent].Data_Easy1,sizeof(CSONG[SelectCurrent].Data_Easy1));
					}
					break;
				case MODE_HARD:
					if(bModeSynchro)
					{
						memcpy(&Data,&CSONG[SelectCurrent].Data_Hard,sizeof(CSONG[SelectCurrent].Data_Hard));
						memcpy(&Data1,&CSONG[SelectCurrent].Data_Hard,sizeof(CSONG[SelectCurrent].Data_Hard));
						
						for(i=0;i<MAX_DATA;i++)
						{
							Data1[i][5]=Data1[i][0];
							Data1[i][6]=Data1[i][1];
							Data1[i][7]=Data1[i][2];
							Data1[i][8]=Data1[i][3];
							Data1[i][9]=Data1[i][4];
						}
					}
					else
					{
						memcpy(&Data,&CSONG[SelectCurrent].Data_Hard1,sizeof(CSONG[SelectCurrent].Data_Hard1));
						memcpy(&Data1,&CSONG[SelectCurrent].Data_Hard1,sizeof(CSONG[SelectCurrent].Data_Hard1));
					}
					break;
			}
		}
		else 
		{
			switch(GameMode)
			{
				case MODE_CRAZY:
					if(Start1p)memcpy(&Data,CSONG[SelectCurrent].Data_Crazy,sizeof(Data));
					else
					{
						memcpy(&Data,CSONG[SelectCurrent].Data_Crazy,sizeof(Data));
						memcpy(&Data1,CSONG[SelectCurrent].Data_Crazy,sizeof(Data));
						for(i=0;i<MAX_DATA;i++)
						{
							Data1[i][5]=Data[i][0];
							Data1[i][6]=Data[i][1];
							Data1[i][7]=Data[i][2];
							Data1[i][8]=Data[i][3];
							Data1[i][9]=Data[i][4];
						}
					}
					break;
				case MODE_EASY:
					if(Start1p)memcpy(&Data,CSONG[SelectCurrent].Data_Easy,sizeof(Data));
					else
					{
						memcpy(&Data,CSONG[SelectCurrent].Data_Easy,sizeof(Data));
						memcpy(&Data1,CSONG[SelectCurrent].Data_Easy,sizeof(Data));
						for(i=0;i<MAX_DATA;i++)
						{
							Data1[i][5]=Data[i][0];
							Data1[i][6]=Data[i][1];
							Data1[i][7]=Data[i][2];
							Data1[i][8]=Data[i][3];
							Data1[i][9]=Data[i][4];
						}
					}
					break;
				case MODE_HARD:
					if(Start1p)memcpy(&Data,CSONG[SelectCurrent].Data_Hard,sizeof(Data));
					else
					{
						memcpy(&Data,CSONG[SelectCurrent].Data_Hard,sizeof(Data));
						memcpy(&Data1,CSONG[SelectCurrent].Data_Hard,sizeof(Data));
						for(i=0;i<MAX_DATA;i++)
						{
							Data1[i][5]=Data[i][0];
							Data1[i][6]=Data[i][1];
							Data1[i][7]=Data[i][2];
							Data1[i][8]=Data[i][3];
							Data1[i][9]=Data[i][4];
						}
					}
					break;
			}
		}

		bpm=CSONG[SelectCurrent].bpm;
		bpm2=CSONG[SelectCurrent].bpm2;
		bpm3=CSONG[SelectCurrent].bpm3;
		bunki=CSONG[SelectCurrent].Bunki;
		bunki2=CSONG[SelectCurrent].Bunki2;
		
		switch(GameMode)
		{
			case MODE_CRAZY:
				start=CSONG[SelectCurrent].Crazy_Start;
				start2=CSONG[SelectCurrent].Crazy_Start2;
				start3=CSONG[SelectCurrent].Crazy_Start3;
				tick=CSONG[SelectCurrent].Crazy_Tick;
				break;
			case MODE_HARD:
				start=CSONG[SelectCurrent].Hard_Start;
				start2=CSONG[SelectCurrent].Hard_Start2;
				start3=CSONG[SelectCurrent].Hard_Start3;
				tick=CSONG[SelectCurrent].Hard_Tick;
				break;
			case MODE_EASY:
				start=CSONG[SelectCurrent].Easy_Start;
				start2=CSONG[SelectCurrent].Easy_Start2;
				start3=CSONG[SelectCurrent].Easy_Start3;
				tick=CSONG[SelectCurrent].Easy_Tick;
				break;
			case MODE_DOUBLE:
				start=CSONG[SelectCurrent].Double_Start;
				start2=CSONG[SelectCurrent].Double_Start2;
				start3=CSONG[SelectCurrent].Double_Start3;
				tick=CSONG[SelectCurrent].Double_Tick;
				break;
		}

		strcpy(SongName,CSONG[SelectCurrent].WavName);
		strcpy(SongName2,CSONG[SelectCurrent].MP3Name);
		strcpy(SongName3,CSONG[SelectCurrent].MPGName);
		strcpy(Title,CSONG[SelectCurrent].SongTitle);

		Judgement1p=NONE;
		Judgement2p=NONE;

		if(GameMode==MODE_DOUBLE)ProgramState=DOUBLE;
//		else if(Couple)ProgramState=COUPLE;
		else ProgramState=STAGE1;
		
		if(GameMode==MODE_DOUBLE)
		{
			if(Start1p && Start2p) Start2p=FALSE;
		}
		Selected=0;
		
		if(g_dsSelectSong)g_dsSelectSong->Stop();
		if(IntroFlag){intro->OnMediaStop();delete intro;IntroFlag=FALSE;}
		
		if(access(SongName,04)==0)
		{
			SongFlag=TRUE;
			song=new CMedia;
			song->OpenMediaFile(SongName);
		}
		else if(access(SongName2,04)==0)
		{
			SongFlag=TRUE;
			song=new CMedia;
			song->OpenMediaFile(SongName2);
		}
		else SongFlag=FALSE;

		DDFillSurface(g_pDDSBack, 0); // ????

		First=0;
		Combo1p=0;
		Combo2p=0;

		cPerfect1p=0;
		cGreat1p=0;
		cGood1p=0;
		cBad1p=0;
		cMiss1p=0;
		cMaxCombo1p=0;

		cPerfect2p=0;
		cGreat2p=0;
		cGood2p=0;
		cBad2p=0;
		cMiss2p=0;
		cMaxCombo2p=0;

		dwState=0;
		dwState2=0;

		start1=0;

		PressedKey1p[0]=0;
		PressedKey2p[0]=0;
		SelectCurrent=0;

		return;
		
	}

	g_pDDSBack->BltFast(0,0,SelectBack,NULL,DDBLTFAST_NOCOLORKEY);

	curTimer=timeGetTime();

	int i2;

	i2=(int)(curTimer-startTimer)/1000;
	sprintf(s,"%02d", (40 - i2));
	//sprintf(s, "99");

	if(0>=(40-i2))
	{
		if(Selected==7)SelectCurrent=current,PressedKey1p[0]=3;
		else if(Selected==9)SelectCurrent=CSONG[current].Next, PressedKey1p[0]=3;
		else SelectCurrent=current,PressedKey1p[0]=3;
	}
		
	DisplayNumber(560,8,s);
	
	if(Selected==7)
	{
			Screen.top=50-zoom;
			Screen.bottom=50+DISCSIZE_Y+zoom;
			Screen.left=10-zoom;
			Screen.right=10+DISCSIZE_X+zoom;
	}
	else
	{
		Screen.top=50;
		Screen.bottom=50+DISCSIZE_Y;
		Screen.left=10;
		Screen.right=10+DISCSIZE_X;
	}
	
	if(iMove<0)
	{
		if(iMove<=-640)iMove=0;
		else 
		{
			iMove-=8;

			ClpBlt3(10+iMove,50,CSONG[CSONG[CSONG[current].Prev].Prev].DiskImage, &DiscSize,DDBLTFAST_SRCCOLORKEY);
			ClpBlt3(650+iMove,50,CSONG[current].DiskImage, &DiscSize,DDBLTFAST_SRCCOLORKEY);
		}
	}
	else if(iMove>0)
	{
		if(iMove>=640)iMove=0;
		else
		{
			iMove+=8;
		
			ClpBlt3(-630+iMove,50,CSONG[current].DiskImage, &DiscSize, DDBLTFAST_SRCCOLORKEY);
			ClpBlt3(10+iMove,50,CSONG[CSONG[CSONG[current].Next].Next].DiskImage, &DiscSize, DDBLTFAST_SRCCOLORKEY);
		}
	}
	else if(iMove==0)g_pDDSBack->Blt(&Screen,CSONG[current].DiskImage, &DiscSize, DDBLT_KEYSRC,NULL);
	
	if(Selected==9)
	{
			Screen.top=50-zoom;
			Screen.bottom=50+DISCSIZE_Y+zoom;
			Screen.left=330-zoom;
			Screen.right=330+DISCSIZE_X+zoom;
	}
	else
	{
		Screen.top=50;
		Screen.bottom=50+DISCSIZE_Y;
		Screen.left=330;
		Screen.right=330+DISCSIZE_X;
	}
	if(iMove<0)
	{
		if(iMove<=-640)iMove=0;
		else
		{
			iMove-=8;

			ClpBlt3(330+iMove,50,CSONG[CSONG[CSONG[CSONG[current].Prev].Prev].Next].DiskImage, &DiscSize,DDBLTFAST_SRCCOLORKEY);
			ClpBlt3(970+iMove,50,CSONG[CSONG[current].Next].DiskImage, &DiscSize,DDBLTFAST_SRCCOLORKEY);
		}
	}
	else if(iMove>0)
	{
		if(iMove>=640)iMove=0;
		else
		{
			iMove+=8;
		
			ClpBlt3(-310+iMove,50,CSONG[CSONG[current].Next].DiskImage, &DiscSize, DDBLTFAST_SRCCOLORKEY);
			ClpBlt3(330+iMove,50,CSONG[CSONG[CSONG[CSONG[current].Next].Next].Next].DiskImage, &DiscSize,DDBLTFAST_SRCCOLORKEY);
		}
	}
	else if(iMove==0)g_pDDSBack->Blt(&Screen,CSONG[CSONG[current].Next].DiskImage, &DiscSize, DDBLT_KEYSRC,NULL);

	g_pDDSBack->BltFast(0,250,ShiftLeft,NULL,DDBLTFAST_SRCCOLORKEY);
	g_pDDSBack->BltFast(320,250,ShiftRight,NULL,DDBLTFAST_SRCCOLORKEY);
	
/*	if(PressedKey2p[0]==6)
	{
		switch(GameMode)
		{
			case MODE_EASY:GameMode=MODE_HARD;
				break;
			case MODE_HARD:GameMode=MODE_EASY;
				break;
		}
		PressedKey2p[0]=0;
	}

	else if(PressedKey2p[0]==4)
	{
		switch(GameMode)
		{
			case MODE_EASY:GameMode=MODE_HARD;
				break;
			case MODE_HARD:GameMode=MODE_EASY;
				break;
		}
		PressedKey2p[0]=0;
	} */
/*	switch(GameMode)
	{
		case MODE_EASY:DisplayMessage(200,460,"EASY");break;
		case MODE_HARD:DisplayMessage(200,460,"HARD");break;
	}
	switch(Couple)
	{
		case TRUE:DisplayMessage(100,460,"COUPLE MODE");break;
		case FALSE:DisplayMessage(100,460,"SINGLE MODE");break;
	}
*/	
	if(Selected==7)DisplayMessage(200,300,CSONG[current].SongTitle);
	else if(Selected==9)DisplayMessage(200,300,CSONG[CSONG[current].Next].SongTitle);

	if(bModeMirror1p)DrawMode(0,200,HMODE_MIRROR);
	if(bModeNonstep1p)DrawMode(0,240,HMODE_NONSTEP);
	if(bModeSynchro)DrawMode(0,280,HMODE_SYNCHRO);
	if(bModeUnion1p)DrawMode(0,320,HMODE_UNION);
	if(bModeRandom1p)DrawMode(0,360,HMODE_RANDOM);
	if(bModeVanish1p)DrawMode(0,400,HMODE_VANISH);

	if(HighSpeed1p>1)DrawMode(0,160,HMODE_2X);

	if(bModeMirror2p)DrawMode(600,200,HMODE_MIRROR);
	if(bModeNonstep2p)DrawMode(600,240,HMODE_NONSTEP);
	if(bModeUnion2p)DrawMode(600,320,HMODE_UNION);
	if(bModeRandom2p)DrawMode(600,360,HMODE_RANDOM);
	if(bModeVanish2p)DrawMode(600,400,HMODE_VANISH);

	if(HighSpeed2p>1)DrawMode(600,160,HMODE_2X);

	if(CSONG[current].HaveDouble && iMove==0 )g_pDDSBack->BltFast(0,50, DoubleIcon,NULL, DDBLTFAST_SRCCOLORKEY);
	if(CSONG[CSONG[current].Next].HaveDouble && iMove==0 )g_pDDSBack->BltFast(320,50, DoubleIcon, NULL, DDBLTFAST_SRCCOLORKEY);

	if(CSONG[current].HaveCrazy && iMove==0 )g_pDDSBack->BltFast(0,50, CrazyIcon,NULL, DDBLTFAST_SRCCOLORKEY);
	if(CSONG[CSONG[current].Next].HaveCrazy && iMove==0 )g_pDDSBack->BltFast(320,50, CrazyIcon, NULL, DDBLTFAST_SRCCOLORKEY);

	if(CSONG[current].HaveHard && iMove==0 )g_pDDSBack->BltFast(0,50, HardIcon,NULL, DDBLTFAST_SRCCOLORKEY);
	if(CSONG[CSONG[current].Next].HaveHard && iMove==0 )g_pDDSBack->BltFast(320,50, HardIcon, NULL, DDBLTFAST_SRCCOLORKEY);

	if(CSONG[current].HaveEasy && iMove==0 )g_pDDSBack->BltFast(0,50, EasyIcon,NULL, DDBLTFAST_SRCCOLORKEY);
	if(CSONG[CSONG[current].Next].HaveEasy && iMove==0 )g_pDDSBack->BltFast(320,50, EasyIcon, NULL, DDBLTFAST_SRCCOLORKEY);

/*	int DiffL,DiffR;

	DiffL=0,DiffR=0;
	if(CSONG[current].Double_Diff)DiffL=CSONG[current].Double_Diff;
	else if(CSONG[current].Easy_Diff)DiffL=CSONG[current].Easy_Diff;
	else if(CSONG[current].Hard_Diff)DiffL=CSONG[current].Hard_Diff;
	else if(CSONG[current].Crazy_Diff)DiffL=CSONG[current].Crazy_Diff;

	if(CSONG[CSONG[current].Next].Double_Diff)DiffR=CSONG[CSONG[current].Next].Double_Diff;
	else if(CSONG[CSONG[current].Next].Easy_Diff)DiffR=CSONG[CSONG[current].Next].Easy_Diff;
	else if(CSONG[CSONG[current].Next].Hard_Diff)DiffR=CSONG[CSONG[current].Next].Hard_Diff;
	else if(CSONG[CSONG[current].Next].Crazy_Diff)DiffR=CSONG[CSONG[current].Next].Crazy_Diff;

	if(iMove==0)
	for(i=DiffL;;i--)
	{
		if(i==0)break;
		if(i==1)g_pDDSBack->BltFast(285,145,Diff,NULL,DDBLTFAST_SRCCOLORKEY);

		if(i==2)g_pDDSBack->BltFast(283,125,Diff,NULL,DDBLTFAST_SRCCOLORKEY);
		if(i==3)g_pDDSBack->BltFast(283,165,Diff,NULL,DDBLTFAST_SRCCOLORKEY);

		if(i==4)g_pDDSBack->BltFast(281,105,Diff,NULL,DDBLTFAST_SRCCOLORKEY);
		if(i==5)g_pDDSBack->BltFast(281,105,Diff,NULL,DDBLTFAST_SRCCOLORKEY);

		if(i==6)g_pDDSBack->BltFast(279,85,Diff,NULL,DDBLTFAST_SRCCOLORKEY);
		if(i==7)g_pDDSBack->BltFast(279,185,Diff,NULL,DDBLTFAST_SRCCOLORKEY);
	}

	if(iMove==0)
	for(i=DiffR;;i--)
	{
		if(i==0)break;
		if(i==1)g_pDDSBack->BltFast(330,145,Diff,NULL,DDBLTFAST_SRCCOLORKEY);

		if(i==2)g_pDDSBack->BltFast(332,125,Diff,NULL,DDBLTFAST_SRCCOLORKEY);
		if(i==3)g_pDDSBack->BltFast(332,165,Diff,NULL,DDBLTFAST_SRCCOLORKEY);

		if(i==4)g_pDDSBack->BltFast(334,105,Diff,NULL,DDBLTFAST_SRCCOLORKEY);
		if(i==5)g_pDDSBack->BltFast(334,105,Diff,NULL,DDBLTFAST_SRCCOLORKEY);

		if(i==6)g_pDDSBack->BltFast(336,85,Diff,NULL,DDBLTFAST_SRCCOLORKEY);
		if(i==7)g_pDDSBack->BltFast(336,185,Diff,NULL,DDBLTFAST_SRCCOLORKEY);
	}
*/
//	DrawMode(0,0,HMODE_UNION);


	g_pDDSBack->BltFast(210,450,CFont, &lRect, DDBLTFAST_SRCCOLORKEY);

	if(Start1p)
	{
		if(a==0)
		{
			a++;
			if(Start1p && Start2p)Couple=TRUE;
			else Couple=FALSE;
		}
	}
	if(Start2p)
	{
		if(b==0)
		{
			b++;
			if(Start1p && Start2p)Couple=TRUE;
			else Couple=FALSE;
		}
	}

	if(Start1p==FALSE)
	{
		lRect.top=0;
		lRect.left=0;
		lRect.right=220;
		lRect.bottom=23;

		TransAlphaImproved(CFont, g_pDDSBack, 10, 450, lRect, ALPHA, CKey_CFont, 16);
	}
	if(Start2p==FALSE)//DisplayMessageC(320,480-20,"PRESS CENTER STEP");
	{
		lRect.top=0;
		lRect.left=0;
		lRect.right=220;
		lRect.bottom=23;

		TransAlphaImproved(CFont, g_pDDSBack, 410, 450, lRect, ALPHA, CKey_CFont, 16);
	}

	ALPHA += inc;
	if (ALPHA > 256)
	{
		ALPHA = 256;
		inc = -10;
	}
	else if (ALPHA < 0)
	{
		ALPHA = 0;
		inc = 10;
	}

	Flipp();

}