// seg000:024F void __pascal far init_game_main() { doorlink1_ad = /*&*/level.doorlinks1; doorlink2_ad = /*&*/level.doorlinks2; prandom(1); if (graphics_mode == gmMcgaVga) { // Guard palettes guard_palettes = (byte*) load_from_opendats_alloc(10, "bin", NULL, NULL); // (blood, hurt flash) #E00030 = red set_pal(12, 0x38, 0x00, 0x0C, 1); // (palace wall pattern) #C09850 = light brown set_pal( 6, 0x30, 0x26, 0x14, 0); // Level color variations (1.3) level_var_palettes = load_from_opendats_alloc(20, "bin", NULL, NULL); } // PRINCE.DAT: sword chtab_addrs[id_chtab_0_sword] = load_sprites_from_file(700, 1<<2, 1); // PRINCE.DAT: flame, sword on floor, potion chtab_addrs[id_chtab_1_flameswordpotion] = load_sprites_from_file(150, 1<<3, 1); close_dat(dathandle); load_sounds(0, 43); load_opt_sounds(43, 56); //added hof_read(); show_use_fixes_and_enhancements_prompt(); // added start_game(); }
int main(int argc, char *argv[]) { SDL_Init(SDL_INIT_AUDIO); if(Mix_OpenAudio(22050, AUDIO_S16, 2, 4096)) { fprintf(stderr,"Unable to open audio\n"); return 0; } load_sounds(); g_thread_init(NULL); gtk_init(&argc, &argv); GtkWidget *window, *hbox, *connect, *table, *vbox; ggraph = gtk_drawing_area_new(); vbox = gtk_vbox_new(FALSE,0); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); hbox = gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(vbox),ggraph,TRUE,TRUE,0); gtk_box_pack_start(GTK_BOX(vbox),hbox,TRUE,TRUE,0); connect = gtk_button_new_with_label("Connect to Wiimote"); ypos[0] = gtk_entry_new(); ypos[1] = gtk_entry_new(); gtk_entry_set_editable(GTK_ENTRY(ypos[0]),FALSE); gtk_entry_set_editable(GTK_ENTRY(ypos[1]),FALSE); dwn[0] = gtk_hscale_new_with_range(-3.0,3.0,0.1); gtk_range_set_value(GTK_RANGE(dwn[0]),0.1); dwn[1] = gtk_hscale_new_with_range(-3.0,3.0,0.1); gtk_range_set_value(GTK_RANGE(dwn[1]),0.1); up[0] = gtk_hscale_new_with_range(-3.0,3.0,0.1); gtk_range_set_value(GTK_RANGE(up[0]),-0.4); up[1] = gtk_hscale_new_with_range(-3.0,3.0,0.1); gtk_range_set_value(GTK_RANGE(up[1]),-0.4); table = gtk_table_new(3,2,0); gtk_table_attach_defaults(GTK_TABLE(table),ypos[0],0,1,0,1); gtk_table_attach_defaults(GTK_TABLE(table),ypos[1],1,2,0,1); gtk_table_attach_defaults(GTK_TABLE(table),dwn[0],0,1,1,2); gtk_table_attach_defaults(GTK_TABLE(table),dwn[1],1,2,1,2); gtk_table_attach_defaults(GTK_TABLE(table),up[0],0,1,2,3); gtk_table_attach_defaults(GTK_TABLE(table),up[1],1,2,2,3); gtk_box_pack_start(GTK_BOX(hbox),connect,TRUE,TRUE,0); gtk_box_pack_start(GTK_BOX(hbox),table,TRUE,TRUE,0); gtk_container_add(GTK_CONTAINER(window),vbox); gtk_widget_set_size_request(ggraph, 500,300); g_signal_connect(G_OBJECT(window),"delete-event",G_CALLBACK(window_close),NULL); g_signal_connect(G_OBJECT(connect),"clicked",G_CALLBACK(find_wiimote),NULL); gtk_widget_show_all(window); gtk_main(); Mix_CloseAudio(); SDL_Quit(); return 0; }
/* FUNCION: audio_init Inicio del mixer. */ int audio_init(void) { #ifndef NOSOUND if (!load_sounds()) return 0; /* Se cargan las musicas */ return load_musics(); #else return 1; #endif }
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmdShow) { MSG msg; WNDCLASS wndclass,wndclass2; short seed; if (!hPrevInstance) { wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10)); wndclass.hCursor = NULL; wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass.lpszMenuName = MAKEINTRESOURCE(1); wndclass.lpszClassName = szAppName; RegisterClass(&wndclass); wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; wndclass2.lpfnWndProc = WndProc; wndclass2.cbClsExtra = 0; wndclass2.cbWndExtra = 0; wndclass2.hInstance = hInstance; wndclass2.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10)); wndclass2.hCursor = NULL; wndclass2.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass2.lpszMenuName = NULL; wndclass2.lpszClassName = szWinName; RegisterClass(&wndclass2); } mainPtr = CreateWindow (szAppName, "Classic Blades of Exile Character Editor", WS_OVERLAPPEDWINDOW, 0, 0, 536, 478, NULL, NULL, hInstance, NULL); if (!hPrevInstance) { // initialize Get_Path(file_path_name); //store the path to the executable store_hInstance = hInstance; accel = LoadAccelerators(hInstance, MAKEINTRESOURCE(1)); get_reg_data(); load_cursors(); seed = (short) GetCurrentTime(); srand(seed); max_window(mainPtr); Set_up_win (); font = CreateFont(-9,0,0,0,0, 0,0,0, 0,0, 0,0,0,"MS Sans Serif"); small_bold_font = CreateFont(12,0,0,0,700, 0,0,0, 0,0, 0,0,0,"MS Sans Serif"); italic_font = CreateFont(12,0,0,0,0, 1,0,0, 0,0, 0,0,0,"MS Sans Serif"); underline_font = CreateFont(12,0,0,0,0, 0,1,0, 0,0, 0,0,0,"MS Sans Serif"); bold_font = CreateFont(14,0,0,0,700, 0,0,0, 0,0, 0,0,0,"MS Sans Serif"); tiny_font = font; load_sounds(); ShowWindow(mainPtr,nCmdShow); init_main_buttons(); file_initialize(); check_colors(); cursor_stay(); update_item_menu(1); cd_init_dialogs(); FCD(900,0); } event_handled = FALSE; while(GetMessage(&msg,NULL,0,0)) { if (event_handled == FALSE) { if (!TranslateAccelerator(mainPtr, accel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } return msg.wParam; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmdShow) { MSG msg; WNDCLASS wndclass, wndclass2; RECT windRECT; HINSTANCE boeSoundsDLL; wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10)); wndclass.hCursor = NULL; wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass.lpszMenuName = MAKEINTRESOURCE(1); wndclass.lpszClassName = szAppName; RegisterClass(&wndclass); wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; wndclass2.lpfnWndProc = WndProc; wndclass2.cbClsExtra = 0; wndclass2.cbWndExtra = 0; wndclass2.hInstance = hInstance; wndclass2.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10)); wndclass2.hCursor = NULL; wndclass2.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass2.lpszMenuName = NULL; wndclass2.lpszClassName = szWinName; RegisterClass(&wndclass2); mainPtr = CreateWindow (szAppName, "Classic Blades of Exile", WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 0, 0, 588, 478, NULL, NULL, hInstance, NULL); if (!hPrevInstance) { // initialize Get_Path(file_path_name); store_hInstance = hInstance; accel = LoadAccelerators(hInstance, MAKEINTRESOURCE(1)); boeSoundsDLL = LoadLibrary("./boesounds.dll"); if (!boeSoundsDLL) { MessageBox(mainPtr, "BOESOUNDS.DLL not found", "Error", MB_OK | MB_ICONEXCLAMATION); return (-1); } load_sounds(boeSoundsDLL); loadFonts(); loadCursors(); SetCursor(sword_curs); current_cursor = 124; /* cursors loaded */ data_store = new piles_of_stuff_dumping_type; data_store3 = new piles_of_stuff_dumping_type3; data_store4 = new piles_of_stuff_dumping_type4; data_store5 = new piles_of_stuff_dumping_type5; scen_item_list = new scen_item_data_type; srand(GetCurrentTime()); get_reg_data(); if (display_mode != 5) max_window(mainPtr); else { GetWindowRect(GetDesktopWindow(),&windRECT); MoveWindow(mainPtr,(windRECT.right - (588 + 10)) / 2, (windRECT.bottom - (425 + 52)) / 2 , 588 + 10,425 + 52,true); } shop_sbar = CreateWindow("scrollbar",NULL, WS_CHILD | WS_TABSTOP | SBS_VERT, shop_sbar_rect.left,shop_sbar_rect.top,shop_sbar_rect.right,shop_sbar_rect.bottom, mainPtr,(HMENU) 3, store_hInstance,NULL); lpsi.fMask = SIF_RANGE; lpsi.nMax = 16; SetScrollInfo(shop_sbar,SB_CTL,&lpsi,false); // SetScrollRange(shop_sbar,SB_CTL,0,16,false); ShowWindow(mainPtr, nCmdShow); plop_fancy_startup(); init_screen_locs(); FlushEvents(2); SetTimer(mainPtr,1,620,NULL); SetTimer(mainPtr,2,200,NULL); file_initialize(); if (GetDeviceCaps(main_dc,BITSPIXEL) * GetDeviceCaps(main_dc,PLANES) < 8) { MessageBox(mainPtr,"Blades of Exile is designed for 256 colors. The current graphics device is set for less. Exile 3 is playable with less colors, but will look somewhat odd." , "Not 256 colors!",MB_OK | MB_ICONEXCLAMATION); MessageBox(mainPtr,"For tips on how to get 256 colors, hit F1 for help, and then select 'Getting 256 Colors' from the table of contents." , "Not 256 colors!",MB_OK | MB_ICONEXCLAMATION); } menu_activate(0); cursor_stay(); showcursor(true); reset_text_bar(); adjust_window_mode(); cd_init_dialogs(); if (game_run_before == false) { FCD(986,0); WritePrivateProfileString("Blades of Exile", "game_run_before", "1", "./blades.ini"); } else if (give_intro_hint == true) tip_of_day(); } event_handled = false; while(GetMessage(&msg,NULL,0,0)) { if (event_handled == false) { if (!TranslateAccelerator(mainPtr, accel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } delete scen_item_list; delete data_store5; delete data_store4; delete data_store3; if(data_store2 != NULL) delete[] data_store2; if(scen_headers != NULL) delete[] scen_headers; delete data_store; lose_graphics(); FreeLibrary((HMODULE) boeSoundsDLL); return msg.wParam; }
/* * This initialization function is just to make it easier to manually edit the 'to-be-loaded' font list. * In the future, FontMan should read from some kind of resource file so we don't need to specify these by * hand */ void AudioManager::init() { alutInit(0, NULL); sound_names_.push_back(std::string("res/sounds/starshipmono.wav")); load_sounds(); }
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR, int nCmdShow) { MSG msg; WNDCLASS wndclass,wndclass2; short seed; if (!hPrevInstance) { wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10)); wndclass.hCursor = NULL; wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass.lpszMenuName = MAKEINTRESOURCE(1); wndclass.lpszClassName = szAppName; RegisterClass(&wndclass); wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; wndclass2.lpfnWndProc = WndProc; wndclass2.cbClsExtra = 0; wndclass2.cbWndExtra = 0; wndclass2.hInstance = hInstance; wndclass2.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10)); wndclass2.hCursor = NULL; wndclass2.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass2.lpszMenuName = NULL; wndclass2.lpszClassName = szWinName; RegisterClass(&wndclass2); } mainPtr = CreateWindow (szAppName, "Classic Blades of Exile Scenario Editor", WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 0, 0, 536, 478, NULL, NULL, hInstance, NULL); if (!hPrevInstance) { // initialize //center_window(mainPtr); Get_Path(file_path_name); store_hInstance = hInstance; accel = LoadAccelerators(hInstance, MAKEINTRESOURCE(1)); loadSettingsFromFile(); seed = (short) GetCurrentTime(); srand(seed); data_store = new piles_of_stuff_dumping_type; max_window(mainPtr); GetWindowRect(mainPtr,&windRect); SetTimer(mainPtr,1,20,NULL); ShowWindow(mainPtr,nCmdShow); Set_up_win (); init_lb(); init_rb(); init_town(1); init_out(); init_scenario(); font = CreateFont(12,0,0,0,0, 0,0,0, 0,0, 0,0,0,"MS Sans Serif"); small_bold_font = CreateFont(12,0,0,0,700, 0,0,0, 0,0, 0,0,0,"MS Sans Serif"); italic_font = CreateFont(12,0,0,0,0, 1,0,0, 0,0, 0,0,0,"MS Sans Serif"); underline_font = CreateFont(12,0,0,0,0, 0,1,0, 0,0, 0,0,0,"MS Sans Serif"); bold_font = CreateFont(14,0,0,0,700, 0,0,0, 0,0, 0,0,0,"MS Sans Serif"); tiny_font = font; load_sounds(); right_sbar_rect.top = RIGHT_AREA_UL_Y; right_sbar_rect.left = RIGHT_AREA_UL_X + RIGHT_AREA_WIDTH - 16 ; right_sbar_rect.bottom = RIGHT_AREA_UL_Y + RIGHT_AREA_HEIGHT; right_sbar_rect.right = RIGHT_AREA_UL_X + RIGHT_AREA_WIDTH ; right_sbar = CreateWindow("scrollbar",NULL, WS_CHILD | WS_TABSTOP | SBS_VERT, right_sbar_rect.left + ulx,right_sbar_rect.top + uly, right_sbar_rect.right - right_sbar_rect.left, right_sbar_rect.bottom - right_sbar_rect.top, mainPtr,(HMENU) 1,store_hInstance,NULL); init_screen_locs(); set_up_start_screen(); file_initialize(); check_colors(); cursor_stay(); update_item_menu(); shut_down_menus(0); cd_init_dialogs(); } event_handled = FALSE; while(GetMessage(&msg,NULL,0,0)) { if (event_handled == FALSE) { if (!TranslateAccelerator(mainPtr, accel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } delete data_store; saveSettingsToFile(); return msg.wParam; }
bool load_assets() { // ======================= LOAD IMAGES ============================ // graph paper background background = load_image("assets/images/graph-paper-640-480.png"); if(background == NULL) { fprintf(stderr, "Error: background image not loaded\n"); return false; } // board image boardImg = load_image("assets/images/board.png"); if(board == NULL) { fprintf(stderr, "Error: board could not be loaded\n"); return false; } // red ball red = load_image("assets/images/red.png"); if(red == NULL) { fprintf(stderr,"Error: Red ball loading failed\n"); return false; } // yellow ball yellow = load_image("assets/images/yellow.png"); if(yellow == NULL) { fprintf(stderr, "Error: Yellow ball loading failed\n"); return false; } // icon icon = load_image("assets/images/red.png"); if(icon == NULL) { fprintf(stderr, "Error: Window icon could not be loaded\n"); return false; } // Charged Productions Logo chargedProductionsLogo = load_image("assets/images/cp-logo.png"); if(chargedProductionsLogo == NULL) { fprintf(stderr, "Error: Charged Productions Logo failed to load"); return false; } // ======================== LOAD FONTS ============================= // play button playFont = TTF_OpenFont("assets/fonts/GreasySpoonNF.ttf", 30); if(playFont == NULL) { fprintf(stderr, "Error: Play button font loading failed\n"); return false; } // small option optionsFont = TTF_OpenFont("assets/fonts/GreasySpoonNF.ttf", 30); if(optionsFont == NULL) { fprintf(stderr, "Error: options font could not be loaded\n"); return false; } // big option font optionsFontBig = TTF_OpenFont("assets/fonts/GreasySpoonNF.ttf", 50); if(optionsFontBig == NULL) { fprintf(stderr, "Error: options font could not be loaded\n"); return false; } // back button backFont = TTF_OpenFont("assets/fonts/GreasySpoonNF.ttf", 30); if(backFont == NULL) { fprintf(stderr, "Error: Back font could not be loaded\n"); return false; } // music option font musicFont = TTF_OpenFont("assets/fonts/GreasySpoonNF.ttf", 30); if(musicFont == NULL) { fprintf(stderr, "Error: music font could not be loaded\n"); return false; } // music on musicOnFont = TTF_OpenFont("assets/fonts/GreasySpoonNF.ttf", 30); if(musicOnFont == NULL) { fprintf(stderr, "Error: music on font could not be loaded\n"); return false; } // music off musicOffFont = TTF_OpenFont("assets/fonts/GreasySpoonNF.ttf", 30); if(musicOffFont == NULL) { fprintf(stderr, "Error: music off font could not be loaded\n"); return false; } // logo logoFont = TTF_OpenFont("assets/fonts/orbitron-black.otf", 40); if(logoFont == NULL) { fprintf(stderr, "Error: Logo font loading failed\n"); return false; } // developed by font chargedProductionsFont = TTF_OpenFont("assets/fonts/LindenHill.otf", 30); if(chargedProductionsFont == NULL) { fprintf(stderr, "Error: Developed by font loading failed\n"); return false; } // website font websiteFont = TTF_OpenFont("assets/fonts/LindenHill.otf", 28); if(websiteFont == NULL) { fprintf(stderr, "Error: website font could not be loaded\n"); return false; } // Are you sure you want to quit font sureFont = TTF_OpenFont("assets/fonts/LindenHill.otf", 24); if(sureFont == NULL) { fprintf(stderr, "Error: sure font could not be loaded\n"); return false; } // yes sureYesFont = TTF_OpenFont("assets/fonts/LindenHill.otf", 28); if(sureYesFont == NULL) { fprintf(stderr, "Error: sure yes font could not be loaded\n"); return false; } //no sureNoFont = TTF_OpenFont("assets/fonts/LindenHill.otf", 28); if(sureNoFont == NULL) { fprintf(stderr, "Error: sure no font could not be loaded\n"); return false; } // turn turnFont = TTF_OpenFont("assets/fonts/LindenHill.otf", 28); if(turnFont == NULL) { fprintf(stderr, "Error: Turn font loading failed\n"); return false; } // win winFont = TTF_OpenFont("assets/fonts/LindenHill.otf", 40); if(winFont == NULL) { fprintf(stderr, "Error: Win font could not be loaded\n"); return false; } // again font againFont = TTF_OpenFont("assets/fonts/LindenHill.otf", 28); if(againFont == NULL) { fprintf(stderr, "Error: Play Again font could not be loaded\n"); return false; } // again yes font againFontYes = TTF_OpenFont("assets/fonts/LindenHill.otf", 28); if(againFontYes == NULL) { fprintf(stderr, "Error: againFontYes could not be loaded\n"); return false; } // again no font againFontNo = TTF_OpenFont("assets/fonts/LindenHill.otf", 28); if(againFontNo == NULL) { fprintf(stderr, "Error: againFontNo could not be loaded\n"); return false; } // main menu font mainMenuFont = TTF_OpenFont("assets/fonts/GreasySpoonNF.ttf", 28); if(mainMenuFont == NULL) { fprintf(stderr, "Error: main menu font loading failed\n"); return false; } // ====== Load Sounds if(load_sounds() != true) { fprintf(stderr, "Sound loading failed\n"); return false; } }