short pick_a_scen() { build_scen_headers(); store_scen_page_on = 0; if (store_num_scen == 0) { FCD(868,0); return -1; } SetCursor(sword_curs); cd_create_dialog_parent_num(947,0); put_scen_info(); if (store_num_scen <= 3) { cd_activate_item(947,3,0); cd_activate_item(947,4,0); } while (dialog_not_toast) ModalDialog(); cd_kill_dialog(947,0); return dialog_answer; }
void edit_party_event_filter (short item_hit) { short which_pc; switch (item_hit) { case 1: dialog_not_toast = false; break; case 41: party.help_received[22] = 0; give_help(222,23,989); return; case 5: case 10: case 15: case 20: case 25: case 30: which_pc = (item_hit - 5) / 5; if (adven[which_pc].main_status != MAIN_STATUS_ABSENT) pick_pc_name(which_pc,989); put_party_stats(); break; case 7: case 12: case 17: case 22: case 27: case 32: which_pc = (item_hit - 7) / 5; pick_race_abil(&adven[which_pc],0,989); put_party_stats(); break; case 8: case 13: case 18: case 23: case 28: case 33: which_pc = (item_hit - 8) / 5; spend_xp(which_pc,0,989); put_party_stats(); break; case 35: case 36: case 37: case 38: case 39: case 40: which_pc = item_hit - 35; if (adven[which_pc].main_status <= MAIN_STATUS_ABSENT) break; if (adven[which_pc].main_status != MAIN_STATUS_ABSENT) pick_pc_graphic(which_pc,1,989); put_party_stats(); break; case 6: case 11: case 16: case 21: case 26: case 31: which_pc = (item_hit - 6) / 5; if (adven[which_pc].main_status != MAIN_STATUS_ABSENT) { if (FCD(1053,989) == 2) adven[which_pc].main_status = MAIN_STATUS_ABSENT; put_party_stats(); } else { give_help(56,0,989); create_pc(which_pc,989); put_party_stats(); cd_initial_draw(989); // extra redraw, just in case } break; // case 7: case 12: case 17: case 22: case 27: case 32: } }
Boolean verify_restore_quit(short mode) //short mode; // 0 - quit 1- restore { short choice; if (file_in_mem == FALSE) return TRUE; choice = FCD(1066 + mode,0); if (choice == 3) return FALSE; if (choice == 2) return TRUE; save_file(0); return TRUE; }
Boolean handle_menu (short item, HMENU) { short i,j,k; Boolean to_return = FALSE; item_record_type store_i; if ((file_in_mem == FALSE) && ((item == 1) || (item == 3) || (item >= 40)) && (item != 200) && (item != 100)) { display_strings(20,5,0,0,"Editing party",57,707,0); item = -1; } switch (item) { case -1: break; case 1: save_file(0); break; case 2: if (verify_restore_quit(1) == TRUE) load_file(); update_item_menu(item_menus_lock); break; case 3: save_file(1); break; case 4: All_Done = verify_restore_quit(0); break; case 41: edit_gold_or_food(0); redraw_screen(); break; case 42: edit_gold_or_food(1); redraw_screen(); break; case 44: if (party.stuff_done[304][0] > 0) { FCD(909,0); break; } FCD(901,0); leave_town(); break; case 45: if (party.stuff_done[304][0] == 0) { FCD(911,0); break; } FCD(910,0); c_town.p_loc.x = party.stuff_done[304][1]; c_town.p_loc.y = party.stuff_done[304][2]; party.stuff_done[304][0] = 0; for (i = 0; i < 6; i++) if (adven[i].main_status >= 10) adven[i].main_status -= 10; redraw_screen(); break; case 48: display_strings(20,20,0,0,"Editing party",57,707,0); for (i = 0; i < 4; i++) party.creature_save[i].which_town = 200; break; case 51: // damage display_strings(20,1,0,0,"Editing party",57,715,0); for (i = 0; i < 6; i++) adven[i].cur_health = adven[i].max_health; redraw_screen(); break; case 52: // spell pts display_strings(20,2,0,0,"Editing party",57,715,0); for (i = 0; i < 6; i++) adven[i].cur_sp = adven[i].max_sp; redraw_screen(); break; case 53: // raise dead display_strings(20,3,0,0,"Editing party",57,715,0); for (i = 0; i < 6; i++) if ((adven[i].main_status == 2) || (adven[i].main_status == 3) || (adven[i].main_status == 4)) adven[i].main_status = 1; redraw_screen(); break; case 54: // conditions display_strings(20,4,0,0,"Editing party",57,715,0); for (i = 0; i < 6; i++) { adven[i].status[2] = 0; if (adven[i].status[3] < 0) adven[i].status[3] = 0; adven[i].status[6] = 0; adven[i].status[7] = 0; adven[i].status[9] = 0; adven[i].status[11] = 0; adven[i].status[12] = 0; adven[i].status[13] = 0; } redraw_screen(); break; case 55: if (party_in_scen == FALSE) { display_strings(20,25,0,0,"Editing party",57,715,0); break; } if (FCD(912,0) != 1) break; remove_party_from_scen(); party.stuff_done[304][0] = 0; redraw_screen(); break; case 62: display_alchemy(); break; case 63: // all property display_strings(20,6,0,0,"Editing party",57,707,0); for (i = 0; i < 30; i++) { party.boats[i].property = FALSE; party.horses[i].property = FALSE; } break; case 70: // edit day edit_day(); break; case 71: // out maps if (party_in_scen == FALSE) { display_strings(20,25,0,0,"Editing party",57,715,0); break; } display_strings(20,13,0,0,"Editing party",57,715,0); for (i = 0; i < 96; i++) for (j = 0; j < 96; j++) out_e[i][j] = 1; for (i = 0; i < 100; i++) for (j = 0; j < 6; j++) for (k = 0; k < 48; k++) o_maps.outdoor_maps[i][j][k] = 255; break; case 72: // town maps if (party_in_scen == FALSE) { display_strings(20,25,0,0,"Editing party",57,715,0); break; } display_strings(20,14,0,0,"Editing party",57,715,0); for (i = 0; i < 64; i++) for (j = 0; j < 64; j++) c_town.explored[i][j] = 1; for (i = 0; i < 200; i++) for (j = 0; j < 8; j++) for (k = 0; k < 64; k++) town_maps.town_maps[i][j][k] = 255; break; case 100: // index WinHelp(mainPtr,"Blades of Exile.hlp",HELP_CONTENTS,0L); break; case 200: // about FCD(1062,0); break; default: item -= 600; store_i = scen_item_list.scen_items[item]; if(store_i.variety == 3){ party.gold += get_ran(1,1,20); redraw_screen(); break; } if(store_i.variety == 11){ party.food += get_ran(1,1,20); redraw_screen(); break; } give_to_pc(current_active_pc,store_i,FALSE); draw_items(1); break; } return to_return; }
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; }
Boolean handle_menu (short item, HMENU) { short choice,i; POINT x = {1001,0},pass_point; Boolean to_return = false; switch (item) { case 1: // File Menu if (in_startup_mode == true) startup_load(); else do_load(); break; case 2: do_save(0); break; case 3: if (in_startup_mode == true) save_file(1); else do_save(1); break; case 4: if (in_startup_mode == false) { choice = FCD(1091,0); if (choice == 1) return false; for (i = 0; i < 6; i++) adven[i].main_status = MAIN_STATUS_ABSENT; party_in_memory = false; reload_startup(); in_startup_mode = true; draw_startup(0); } start_new_game(); draw_startup(0); break; case 6: pick_preferences(); break; case 7: pick_compatibility(); break; case 8: // Quit if (in_startup_mode == true) { to_return = All_Done = true; break; } if (overall_mode > MODE_TOWN) { choice = FCD(1067,0); if (choice == 1) return All_Done; } else { choice = FCD(1066,0); if (choice == 3) break; if (choice == 1) save_file(0); } to_return = All_Done = true; break; // Options menu case 21: choice = char_select_pc(0,0,"New graphic for who?"); if (choice < 6) pick_pc_graphic(choice,1,0); initiate_redraw(); break; case 22: choice = select_pc(0,0); if (choice < 6) pick_pc_name(choice,0); put_pc_screen(); put_item_screen(stat_window,0); break; case 23: if (!(is_town())) { add_string_to_buf("Add PC: Town mode only."); print_buf(); break; } for (i = 0; i < NUM_OF_PCS; i++) if (adven[i].main_status == MAIN_STATUS_ABSENT) i = 20; if (i == INVALID_PC) { ASB("Add PC: You already have 6 PCs."); print_buf(); } if (c_town.town_num == scenario.which_town_start) { give_help(56,0,0); create_pc(6,0); } else { add_string_to_buf("Add PC: You can only make new"); add_string_to_buf(" characters in the town you "); add_string_to_buf(" started in."); } print_buf(); put_pc_screen(); put_item_screen(stat_window,0); break; case 24: if (prime_time() == false) { ASB("Finish what you're doing first."); print_buf(); } else { choice = char_select_pc(0,0,"Delete who?"); if (choice < 6) { if ((i = FCD(1053,0)) == 2) adven[choice].kill(0); } initiate_redraw(); } break; case 27: if (overall_mode == MODE_TALKING) { ASB("Talking notes: Can't read while talking."); print_buf(); return to_return; } talk_notes(); break; case 28: adventure_notes(); break; case 29: if (in_startup_mode == false) print_party_stats(); break; // Help menu case 41: FCD(1079,0); break; case 42: FCD(1080,0); break; case 43: FCD(1081,0); break; case 44: FCD(1072,0); break; // magic barriers case 46: FCD(1084,0); break; case 47: FCD(1088,0); break; // Library case 61: display_spells(0,100,0); break; case 62: display_spells(1,100,0); break; case 63: display_skills(100,0); break; case 64: display_help(0,0); break; case 65: tip_of_day(); break; case 67: FCD(986,0); break; // Actions case 81: if (overall_mode != MODE_TOWN) { ASB("Alchemy: In town mode only."); print_buf(); break; } pass_point.x = 1000; pass_point.y = 405; to_return = handle_action(pass_point,(WPARAM) 0,(LPARAM)-1); break; case 82: to_return = handle_action(x,(WPARAM) 0,(LPARAM)-1); break; case 84: if (prime_time() == false) { ASB("Finish what you're doing first."); print_buf(); } else { give_help(62,0,0); display_map(); } SetCursor(sword_curs); break; // Mage is 399 case 399: give_help(209,0,0); party.help_received[9] = false; break; // Priest is 499 case 499: give_help(209,0,0); party.help_received[9] = false; break; // Monsters is 599 case 599: give_help(212,0,0); break; case 100: // Index WinHelp(mainPtr,"Blades of Exile.hlp",HELP_CONTENTS,0L); break; case 200: // About FCD(1062,0); break; default: if ((item >= 400) && (item < 500)) { // mage spell if (prime_time() == false) { ASB("Finish what you're doing first."); print_buf(); } else handle_menu_spell(item - 400,0); break; } if ((item >= 500) && (item < 600)) { // priest spell if (prime_time() == false) { ASB("Finish what you're doing first."); print_buf(); } else handle_menu_spell(item - 500,1); break; } if ((item >= 600) && (item < 700)) { // monster spell display_monst(item - 600,(creature_data_type *) NULL,1); break; } break; } if (in_startup_mode == true) menu_activate(0); else menu_activate(1); return to_return; }
Boolean handle_startup_press(POINT the_point) { short i,scen; long dummy; the_point.x -= ulx; the_point.y -= uly; for (i = 0; i < 5; i++) if (PtInRect(&startup_button[i],the_point) == true) { draw_start_button(i,5); if (play_sounds == true) play_sound(37); else Delay(5,&dummy); draw_start_button(i,0); switch (i) { case 0: startup_load(); break; case 1: draw_startup(0); start_new_game(); draw_startup(0); break; case 2: // Not cross-platform. ShellExecute(NULL, "open", "http://spiderwebforums.ipbhost.com/index.php?/forum/12-blades-of-exile/", NULL, NULL, SW_SHOWNORMAL); draw_startup(0); break; case 3: if (party_in_memory == false) { // check if party is loaded FCD(867,0); //no party loaded error message break; } scen = pick_prefab_scen(); // return a short in scen specifying the chosen scenario if (scen < 0) break; switch (scen) { //put scenario filename in party.scen_name case 0: sprintf(party.scen_name,"valleydy.exs"); break; case 1: sprintf(party.scen_name,"stealth.exs"); break; case 2: sprintf(party.scen_name,"zakhazi.exs"); break; } put_party_in_scen(); //put the party in the scenario and begin the game break; case 4: // intro if (party_in_memory == false) { // check if party is loaded FCD(867,0); //no party loaded error message break; } scen = pick_a_scen(); // return a short to scen specifying the chosen scenario /* if (scen_headers[scen].prog_make_ver[0] >= 2) { => warning if scen = -1 (no scenarios in directory), then it will crash !!! FCD(912,0); break; }*/ if (scen >= 0) { sprintf(party.scen_name,"%s",data_store2[scen].scen_names); //put scenario filename in party.scen_name retrieving it using scen put_party_in_scen(); //put the party in the scenario and begin the game } break; default: Delay(50,&dummy); return true; } } return false; }
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; }
//extern Rect pc_area_buttons[6][6] ; // 0 - whole 1 - pic 2 - name 3 - stat strs 4,5 - later //extern Rect item_string_rects[24][4]; // 0 - name 1 - drop 2 - id 3 - bool handle_action(EventRecord event,short mode) //short mode; // ignore, { short i; Point the_point; short choice = 4; bool to_return = false; the_point = event.where; GlobalToLocal(&the_point); if (file_in_mem == false) return false; for (i = 0; i < 6; i++) if ((PtInRect(the_point,&pc_area_buttons[i][0]) == true) && (univ.party[i].main_status > 0)) { do_button_action(0,i); current_active_pc = i; display_party(6,1); draw_items(1); } for (i = 0; i < 5; i++) if ((PtInRect(the_point,&edit_rect[i][0]) == true) && (univ.party[current_active_pc].main_status > 0)) { do_button_action(0,i + 10); if (save_blocked == false) if ((choice = FCD(904,0)) == 1) return to_return; else save_blocked = true; switch(i) { case 0: display_pc(current_active_pc,0,0); break; case 1: display_pc(current_active_pc,1,0); break; case 2: pick_race_abil(&univ.party[current_active_pc],0,0); break; case 3: spend_xp(current_active_pc,1,0); break; case 4: edit_xp(&univ.party[current_active_pc]); break; } } for (i = 0; i < 24; i++) if ((PtInRect(the_point,&item_string_rects[i][1]) == true) && // drop item (univ.party[current_active_pc].items[i].variety > 0)) { // variety = 0 no item in slot/ non 0 item exists flash_rect(item_string_rects[i][1]); take_item(current_active_pc,i); draw_items(1); } for (i = 0; i < 24; i++) if ((PtInRect(the_point,&item_string_rects[i][2]) == true) && // identify item (univ.party[current_active_pc].items[i].variety > 0)) { flash_rect(item_string_rects[i][2]); univ.party[current_active_pc].items[i].ident = true; draw_items(1); } return to_return; }