//************************************************************************ void CNutDropScene::OnCommand (HWND hWnd, int id, HWND hControl, UINT codeNotify) //************************************************************************ { switch (id) { case IDC_LEVEL1: case IDC_LEVEL2: case IDC_LEVEL3: { int iLevel = id-IDC_LEVEL1; if (iLevel >= NUM_LEVELS) iLevel = NUM_LEVELS-1; PlayClickWave(); ChangeLevel (iLevel); break; } case IDC_HELP: { PlayIntro(NULL); break; } default: CGBScene::OnCommand (hWnd, id, hControl, codeNotify); break; } }
//************************************************************************ void CNutDropScene::ToonInitDone() //************************************************************************ { if (GetToon()) GetToon()->SetHintState(TRUE); CreateSprites(); PlayIntro(m_hWnd); }
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow ) { //WriteDebug("start."); hInstance=hInst; /*#ifdef _DEBUG setupcfg.fullscreen=0; setupcfg.music=0; setupcfg.resolution=4; setupcfg.texturedetail=2; setupcfg.alwaysontop=0; setupcfg.cancel=0; /*#else/**/ //WriteDebug("cfg done."); if (OpenSetupDialog(GetModuleHandle(NULL))) { Initialize(); PrecalcIntro(); if (setupcfg.vsync) { WGLSWAPINTERVALEXT wglSwapIntervalEXT = (WGLSWAPINTERVALEXT) wglGetProcAddress("wglSwapIntervalEXT"); if (wglSwapIntervalEXT) wglSwapIntervalEXT(1); // enable vertical synchronisation } PlayIntro(); if (setupcfg.music) { #ifdef RELEASETYPE_DEMO BASS_ChannelStop(str); BASS_StreamFree(str); #else mvxSystem_Stop(); mvxSystem_DeInit(); #endif } Intro_DestroyWindow(setupcfg.fullscreen==1); } return 0; }
int CGame::SetupGame(char *argv[]) { int bpp = 32; //bits per pixel (truecolor) //buffers for filename manipulation char fullpath[255]; char filename[10]; int ret; //catches return values for processing int i; //universal loop counter //initialise allegro stuff allegro_init(); install_keyboard(); install_mouse(); install_timer(); set_color_depth(bpp); /* Lets play the color depth game! tries 32, 24, then 16 bit color modes */ // set resolution to play intro movie ret = set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); /* did the video mode set properly? */ if (ret != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Error setting %d bit graphics mode\n%s\nLets try another color depth!", bpp, allegro_error); bpp = 24; set_color_depth(bpp); // set resolution ret = set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); /* did the video mode set properly? */ if (ret != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Error setting %d bit graphics mode\n%s\nLets try another color depth!", bpp, allegro_error); bpp = 16; set_color_depth(bpp); // set resolution ret = set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); /* did the video mode set properly? */ if (ret != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Error setting %d bit graphics mode\n%s\nIm all out of options. Exiting", bpp, allegro_error); return 1; } } } // Load data from data.dat into memory textout_centre(screen,font,"NOW LOADING",SCREEN_W/2,SCREEN_H/2,makecol(255,255,255)); sprintf(filename,"data.dat"); replace_filename(fullpath, argv[0], filename, sizeof(fullpath)); data = load_datafile(fullpath); if (!data) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Cant load file %s for some reason.\nIt should be in the same directory as the .exe\n" "If you have deleted the debug directory to mark this then\ncopy all files from the \"required files\"" "directory into the directory with the .exe\n\nThanks. Scarbble will now crash horribly", filename); return 1; } //make smaller copy of all tiles for (i=0;i<27;i++) { smalltiles[i] = create_bitmap(29,29); rotate_scaled_sprite(smalltiles[i], (WINDOWS_BITMAP *)data[i].dat, 0,0, 0, ftofix(0.8)); } PlayIntro(); AddPlayers(); //stuff that cant be done in the players constructor InitialisePlayers(); //set video mode to play game ret = set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0); /* did the video mode set properly? */ if (ret != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Error setting %d bit graphics mode\n%s\n", bpp, allegro_error); return 1; } //initialise the 'background' screen buffer background = create_bitmap(SCREEN_W, SCREEN_H); clear(background); //clear to black boardcolor = makecol(206,206,90); show_mouse(screen); return 0; }