int DDInitFullscreen(int width, int height, int bpp, HWND hwnd) { HRESULT ret; // create object and test for error if (DirectDrawCreate(NULL, &lpDD, NULL) != DD_OK) { return(0); } // set cooperation level to windowed mode normal if (lpDD->SetCooperativeLevel(hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) != DD_OK) { return(0); } // set the display mode if (lpDD->SetDisplayMode(width, height, bpp) != DD_OK) { return(0); } // set globals screen_height = height; screen_width = width; screen_bpp = bpp; // Create the primary surface memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; // we need to let dd know that we want a complex // flippable surface structure, set flags for that ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; // set the backbuffer count to 1 ddsd.dwBackBufferCount = 1; // create the primary surface ret = lpDD->CreateSurface(&ddsd, &lpDDSPrimary, NULL); // query for the backbuffer i.e the secondary surface ddscaps.dwCaps = DDSCAPS_BACKBUFFER; lpDDSPrimary->GetAttachedSurface(&ddscaps, &lpDDSBack); // clear out both primary and secondary surfaces DDFillSurface(lpDDSPrimary, 0); DDFillSurface(lpDDSBack, 0); DDGetRGB16(); return 1; }
int DDInitWindowed(int width, int height, int bpp, HWND hwnd) { HRESULT ret; // create object and test for error if (DirectDrawCreate(NULL, &lpDD, NULL) != DD_OK) { return(0); } // set cooperation level to windowed mode normal if (lpDD->SetCooperativeLevel(hwnd, DDSCL_NORMAL) != DD_OK) { return(0); } // set globals screen_height = height; screen_width = width; screen_bpp = bpp; // Create the primary surface memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; // all we need for windowed mode is access to the primary surface ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; // create the primary surface ret = lpDD->CreateSurface(&ddsd, &lpDDSPrimary, NULL); // create an offscreen and system mem back surface lpDDSBack = DDCreateSurface(width, height, NULL); lpDD->CreateClipper(0, &lpDDClipper, NULL); lpDDClipper->SetHWnd(0, hwnd); lpDDSPrimary->SetClipper(lpDDClipper); // clear out both primary and secondary surfaces DDFillSurface(lpDDSPrimary, 0); DDFillSurface(lpDDSBack, 0); DDGetRGB16(); return 1; }
/* * FiniApp: * Cleans up the application, frees memory. */ void FiniApp(void) { WriteError("\n ====== KILL ======"); // Kill the game stuff KillStuff(); // Blacken the surfaces of the flipping chain // prevents residue gfx showing up after closing WriteError("\n Clearing Display Surfaces..."); DDFillSurface(lpDDSPrimary, 0); // Fill the primary surface with black DDFillSurface(lpDDSBack, 0); // Fill the back surface with black // shutdown directdraw WriteError("\n Shutting down DirectDraw..."); DDShutdown(); WriteError("\n DirectDraw shut down..."); // shutdown DigitalFX WriteError("\n Shutting down DigitalFX..."); digifxDone(); WriteError("\n DigitalFX shut down..."); // shutdown directsound WriteError("\n Shutting down DirectSound..."); DSShutdown(); WriteError("\n DirectSound shut down..."); // release all input devices WriteError("\n Releasing Control of Input Devices..."); DIReleaseKeyboard(); DIReleaseJoystick(); WriteError("\n Input Devices released..."); // shutdown directinput WriteError("\n Shutting down DirectInput..."); DIShutdown(); WriteError("\n DirectInput shut down..."); WriteError("\n ====== END KILL ======"); // close the error file CloseErrorFile(); }
/* * UpdateMenu: * The routine which determines which menu buttons are being pressed and does * other tidbits of crap */ void UpdateMenu(void) { RECT SrcRect, DesRect; // Source and Destination rectangles HRESULT ret; // Set the source and destination rectangles SetRect(&SrcRect, 0, 0, 640, 480); SetRect(&DesRect, 0, 0, 640, 480); // Blit the lpDDSMenu surface (Menu Graphic) to the back buffer lpDDSBack->Blt(&DesRect, lpDDSMenu, &SrcRect, DDBLT_WAIT, NULL); // If the left mouse button is pressed if (MouseLB) { // Determine what was clicked on if (XYInRect(MouseX, MouseY, &StartGameRect)) { // The start game button was pressed // Game Start Code Here DrawButtonDown(0); // draw the button in it's down (highlighted) position DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } DODPlayClickSound(); // play the clicking sound FadeToBlack(); // Fade the screen to black MidiStop(); // Stop the midi KillMenuGFX(); // release the menu graphic surface InitWorld(); // initialize the world LoadGameGFX(); // Load the games needed graphics Game_State = DOD_PLAYING; // set the game state to DOD_PLAYING } else if (XYInRect(MouseX, MouseY, &LoadGameRect)) { // The load game button was pressed // Load Game Code Here DrawButtonDown(1); // draw the button in it's down (highlighted) position DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } DODPlayClickSound(); // play the clicking sound } else if (XYInRect(MouseX, MouseY, &OptionsRect)) { // The options button was pressed // Options Code Here DrawButtonDown(2); // draw the button in it's down (highlighted) position DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } DODPlayClickSound(); // play the clicking sound } else if (XYInRect(MouseX, MouseY, &CreditsRect)) { // The credits button was pressed // Credits Code Here DrawButtonDown(3); // draw the button in it's down (highlighted) position DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } DODPlayClickSound(); // play the clicking sound FadeToBlack(); // fade the menu to black MidiStop(); // stop the midi MidiPlay(".\\Music\\credits.mid", TRUE); // play the credits music Game_State = DOD_CREDITS; // set the Game_State into Credits mode } else if (XYInRect(MouseX, MouseY, &ExitRect)) { // The exit button was pressed // Exit Code Here DrawButtonDown(4); // draw the button in it's down (highlighted) position DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } DODPlayClickSound(); // play the clicking sound FadeToBlack(); // Fade to a black screen DDFillSurface(lpDDSPrimary, 0); // Fill the primary surface with black DDFillSurface(lpDDSBack, 0); // Fill the back surface with black KillMenuGFX(); // release the menu graphic surface PostMessage(main_window_handle, WM_DESTROY, 0, 0); // Post the destroy window message Game_State = DOD_NOTHING; // set the game state to nothing } else { // No buttons were pressed // Just draw the cursor, and flip DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } } } else { // the mouse button wasn't pressed // just draw the cursor and flip DrawCursor(MouseX, MouseY); // Draw the mouse Cursor ret = DDFlip(); // flip to the primary surface if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } } }
/* * UpdateCredits: * Updates the credits screen */ void UpdateCredits(BOOL *ttl) { RGB rgb; // RGB Triplet For BlitString HRESULT ret; int special[NUM_CREDIT_LINES] = { 1, 0, 0, 1, // Special Color For Each Line Of Intro Text 0, 0, 1, 0, // Special Color For Each Line Of Intro Text 0, 1, 0, 0, // Special Color For Each Line Of Intro Text 1, 0, 0, 0, // Special Color For Each Line Of Intro Text 0, 0, 0, 0, // Special Color For Each Line Of Intro Text 0, 2, 2, 0, // Special Color For Each Line Of Intro Text 0, 0, 0, 2, // Special Color For Each Line Of Intro Text 2, 0, 0, 0, // Special Color For Each Line Of Intro Text 0, 2, 2, 2, // Special Color For Each Line Of Intro Text 2, 2, 0, 2 }; int i; // Variable For Looping // clear out the back surface DDFillSurface(lpDDSBack, 0); // Init The Clock (Used For Wait_Clock) Start_Clock(); // Loop through each line of text for (i = 0; i < NUM_CREDIT_LINES; i++) { // If the line of text has been initialized if (count[i]) { // set the red, green, blue color components based on counter if (special[i] == 0) { if (count[i] > 224) { rgb.r = 255 - (count[i] % 256 + 31); } else { rgb.r = count[i] % 256 + 31; } rgb.g = 0; rgb.b = 0; } else if (special[i] == 1) { if (count[i] > 224) { rgb.r = 255 - (count[i] % 256 + 31); } else { rgb.r = count[i] % 256 + 31; } rgb.g = 0; if (count[i] > 224) { rgb.b = 255 - (count[i] % 256 + 31); } else { rgb.b = count[i] % 256 + 31; } } else if (special[i] == 2) { if (count[i] > 224) { rgb.r = 255 - (count[i] % 256 + 31); } else { rgb.r = count[i] % 256 + 31; } if (count[i] > 224) { rgb.g = 255 - (count[i] % 256 + 31); } else { rgb.g = count[i] % 256 + 31; } rgb.b = 0; } // blit the string to the back surface BlitString(dodcredit_text[i], 30, count[i], &rgb); // decrement the counter by one (moves upward) count[i] -= 1; // determing if it's time to start the next line going if (i != (NUM_CREDIT_LINES - 1)) if (count[i] < 460 && !count[i + 1]) { count[i + 1] = 480; } } } // hold this intro to about 10 frames per second (100 ms) Wait_Clock(100); // flip to the primary surface ret = DDFlip(); if (ret == DDERR_SURFACELOST) { RestoreGraphics(); } // see if it's time to get the hell outa here *ttl = FALSE; for (i = 0; i < NUM_CREDIT_LINES; i++) { if (count[i] > 0) { *ttl = TRUE; } } }
/* * FadeToBlack: * Fades a screen to black */ void FadeToBlack(void) { RECT SrcRect, DesRect; // Source and Destination Rectangles WORD *tmp; // temporary surface memory pointer WORD *ref; WORD *prm; WORD *fastref, *fasttmp; int c, tpitch, rpitch, ppitch; // incrementing variable, temporary surface pitch long i; // another incrementing variable WORD *shade; // Set source and destination rectangles to size of screen SetRect(&SrcRect, 0, 0, 640, 480); SetRect(&DesRect, 0, 0, 640, 480); // Create our temporary surface lpDDSTmp = DDCreateSurface(640, 480, DDSCAPS_SYSTEMMEMORY); lpDDSRef = DDCreateSurface(640, 480, DDSCAPS_SYSTEMMEMORY); // Blit our primary surface into our temporary SYSTEM MEMORY surface #ifdef WINDOWED lpDDSRef->Blt(&DesRect, lpDDSPrimary, &g_rcWindow, DDBLT_WAIT, NULL); #else lpDDSRef->Blt(&DesRect, lpDDSPrimary, &SrcRect, DDBLT_WAIT, NULL); #endif // Lock our temporary surface tmp = DDLockSurface(lpDDSTmp, &tpitch); ref = DDLockSurface(lpDDSRef, &rpitch); prm = DDLockSurface(lpDDSPrimary, &ppitch); for (c = 30; c >= 1; c--) { // get a pointer indexed to the start of the current shade level shade = PixelShade[c]; // "reset" our *fast* surface pointers fastref = ref; fasttmp = tmp; // for every pixel on the screen (640*480=307200) for (i = 0; i < 307200; i++, fasttmp++, fastref++) { // new pixel please.... *fasttmp = shade[*fastref]; } // copy the temp surface to the primary surface // method depends on windowed/full screen #ifdef WINDOWED WORD *fastprm = prm + (g_rcWindow.top * ppitch) + g_rcWindow.left; fasttmp = tmp; for (i = 0; i < 480; i++, fastprm += ppitch, fasttmp += 640) { g_MemCpySys2Vid(fastprm, fasttmp, 1280); // 1280 = 614400 (see below) / 480 } #else // (640*480) = 307200 (words) * 2 = 614400 (bytes) g_MemCpySys2Vid(prm, tmp, 614400); #endif } // unlock our temporary surface DDUnlockSurface(lpDDSTmp); DDUnlockSurface(lpDDSRef); DDUnlockSurface(lpDDSPrimary); // just to make sure the screen is black when this routine is over, fill it with 0 DDFillSurface(lpDDSPrimary, 0); // release our temporary surface lpDDSTmp->Release(); lpDDSTmp = NULL; lpDDSRef->Release(); lpDDSRef = NULL; }
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(); }