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; }
Boolean handle_menu (short item, HMENU menu) { short i; Boolean to_return = FALSE; short item_hit; Boolean need_redraw = FALSE; item_hit = item; switch (item) { case -1: break; case 1: // open load_scenario(); if (overall_mode == 60) { update_item_menu(); set_up_main_screen(); } break; case 2: // save modify_lists(); save_scenario(); break; case 3: // new scen build_scenario(); if (overall_mode == 60) set_up_main_screen(); break; case 5: // quit if (save_check(869) == FALSE) break; discard_graphics(); PostQuitMessage(0); break; // Scenario Menu case 101: if (change_made == TRUE) { give_error("You need to save the changes made to your scenario before you can add a new town.", "",0); return to_return; } if (scenario.num_towns >= 200) { give_error("You have reached the limit of 200 towns you can have in one scenario.", "",0); return to_return; } if (new_town(scenario.num_towns) == TRUE) set_up_main_screen(); break; case 103: edit_scen_details(); break; case 104: edit_scen_intro(); break; case 105: set_starting_loc(); break; case 106: overall_mode = 47; set_string("Select party starting location.",""); break; case 109: lpsi.fMask = SIF_POS; lpsi.nPos = 0; SetScrollInfo(right_sbar,SB_CTL,&lpsi,TRUE); //SetScrollPos(right_sbar,SB_CTL,0,TRUE); start_special_editing(0,0); break; case 110: lpsi.fMask = SIF_POS; lpsi.nPos = 0; SetScrollInfo(right_sbar,SB_CTL,&lpsi,TRUE); //SetScrollPos(right_sbar,SB_CTL,0,TRUE); start_string_editing(0,0); break; case 111: if (change_made == TRUE) { give_error("You need to save the changes made to your scenario before you can add a new town.", "",0); return to_return; } i = pick_import_town(841,0); if (i >= 0) { import_town(i); change_made = TRUE; redraw_screen(); } break; case 112: edit_save_rects(); break; case 113: edit_horses(); break; case 114: edit_boats(); break; case 115: edit_add_town(); break; case 116: edit_scenario_events(); break; case 117: edit_item_placement(); break; case 118: if (change_made == TRUE) { give_error("You need to save the changes made to your scenario before you can delete a town.", "",0); return to_return; } if (scenario.num_towns == 1) { give_error("You can't delete the last town in a scenario. All scenarios must have at least 1 town.", "",0); return to_return; } if (scenario.num_towns - 1 == cur_town) { give_error("You can't delete the last town in a scenario while you're working on it. Load a different town, and try this again.", "",0); return to_return; } if (scenario.num_towns - 1 == scenario.which_town_start) { give_error("You can't delete the last town in a scenario while it's the town the party starts the scenario in. Change the parties starting point and try this again.", "",0); return to_return; } if (fancy_choice_dialog(865,0) == 1) delete_last_town(); break; case 119: if (fancy_choice_dialog(866,0) == 1) { last_file_printed = 0; start_data_dump(); } break; case 120: if (change_made == TRUE) { give_error("You need to save the changes made to your scenario before you can print the file Scenario Text.", "",0); return to_return; } if (fancy_choice_dialog(871,0) == 1) { last_file_printed = 1; scen_text_dump(); redraw_screen(); } break; case 121: if (fancy_choice_dialog(867,0) == 1) { last_file_printed = 2; start_shopping_data_dump(); } break; case 122: if (fancy_choice_dialog(868,0) == 1) { last_file_printed = 3; start_monst_data_dump(); } break; case 123: if (fancy_choice_dialog(890,0) == 1) { last_file_printed = 4; start_spec_data_dump(); } break; case 124: if (fancy_choice_dialog(878,0) == 1) { last_file_printed = 7; object_scenario_data_dump(); } break; // Town Menu case 201: edit_town_details(); break; case 202: edit_town_wand(); break; case 203: overall_mode = 9; mode_count = 2; set_cursor(5); set_string("Set town boundary","Select upper left corner"); break; case 204: frill_up_terrain(); break; case 205: unfrill_terrain(); break; case 206: edit_town_strs(); break; case 208: if (fancy_choice_dialog(863,0) == 2) // add random break; place_items_in_town(); break; case 209: for (i = 0; i < 64; i++) // set not prop town.preset_items[i].property = 0; fancy_choice_dialog(861,0); draw_terrain(); break; case 210: if (fancy_choice_dialog(862,0) == 2) // clear all items break; for (i = 0; i < 64; i++) town.preset_items[i].item_code = -1; draw_terrain(); break; case 213: lpsi.fMask = SIF_POS; lpsi.nPos = 0; SetScrollInfo(right_sbar,SB_CTL,&lpsi,TRUE); //SetScrollPos(right_sbar,SB_CTL,0,TRUE); start_special_editing(2,0); break; case 214: lpsi.fMask = SIF_POS; lpsi.nPos = 0; SetScrollInfo(right_sbar,SB_CTL,&lpsi,TRUE); //SetScrollPos(right_sbar,SB_CTL,0,TRUE); start_string_editing(2,0); break; case 215: edit_advanced_town(); break; case 216: edit_town_events(); break; case 217: if (fancy_choice_dialog(872,0) == 2) // clear all monsters break; for (i = 0; i < 60; i++) { t_d.creatures[i].number = 0; t_d.creatures[i].start_loc.x = 0; t_d.creatures[i].start_loc.y = 0; t_d.creatures[i].spec_enc_code = 0; t_d.creatures[i].time_flag = 0; t_d.creatures[i].spec1 = -1; t_d.creatures[i].spec2 = -1; } break; case 218: if (fancy_choice_dialog(873,0) == 2) // clear all special encounters break; for (i = 0; i < 50; i++) { town.special_locs[i].x = 100; town.special_locs[i].y = 0; town.spec_id[i] = 255; } break; case 219: if (fancy_choice_dialog(874,0) == 2) // clear all fields break; for (i = 0; i < 50; i++) if ((town.preset_fields[i].field_type >= 0) && (town.preset_fields[i].field_type < 9)) { town.preset_fields[i].field_type = 0; town.preset_fields[i].field_loc.x = 0; town.preset_fields[i].field_loc.y = 0; } break; case 220: if (fancy_choice_dialog(876,0) == 2) // clear all stains break; for (i = 0; i < 50; i++) if ((town.preset_fields[i].field_type > 13) && (town.preset_fields[i].field_type < 22)) { town.preset_fields[i].field_type = 0; town.preset_fields[i].field_loc.x = 0; town.preset_fields[i].field_loc.y = 0; } break; case 221: if (fancy_choice_dialog(877,0) == 1) { // make concise town report last_file_printed = 5; start_town_data_dump(); } break; case 222: start_dialogue_editing(0); break; // Outdoor Menu case 301: outdoor_details(); break; case 302: edit_out_wand(0); break; case 303: edit_out_wand(1); break; case 304: frill_up_terrain(); break; case 305: unfrill_terrain(); break; case 306: edit_out_strs(); break; case 307: if (fancy_choice_dialog(875,0) == 2) // clear all special encounters break; for (i = 0; i < 18; i++) { current_terrain.special_locs[i].x = 100; current_terrain.special_locs[i].y = 0; current_terrain.special_id[i] = 255; } case 311: lpsi.fMask = SIF_POS; lpsi.nPos = 0; SetScrollInfo(right_sbar,SB_CTL,&lpsi,TRUE); //SetScrollPos(right_sbar,SB_CTL,0,TRUE); start_special_editing(1,0); break; case 312: lpsi.fMask = SIF_POS; lpsi.nPos = 0; SetScrollInfo(right_sbar,SB_CTL,&lpsi,TRUE); //SetScrollPos(right_sbar,SB_CTL,0,TRUE); start_string_editing(1,0); break; break; case 313: if (fancy_choice_dialog(879,0) == 1) { last_file_printed = 6; start_outdoor_data_dump(); } break; case 401: start_town_edit(); break; case 402: start_out_edit(); break; case 403: short x, y; location spot_hit; if (editing_town == false) { if (change_made == TRUE) { if (save_check(859) == FALSE) break; } x = pick_out(cur_out); if (x >= 0) { spot_hit.x = x / 100; spot_hit.y = x % 100; load_outdoors(spot_hit,0); augment_terrain(spot_hit); start_out_edit(); } } else { if (change_made == TRUE) { if (save_check(859) == FALSE) break; } x = pick_town_num(855,cur_town); if (x >= 0) { load_town(x); start_town_edit(); } } break; case 404: set_up_main_screen(); start_terrain_editing(); break; case 405: set_up_main_screen(); start_monster_editing(0); break; case 406: start_item_editing(0); break; case 407: set_up_main_screen(); break; case 408: // switch view cur_viewing_mode = 1 - cur_viewing_mode; need_redraw = TRUE; draw_main_screen(); draw_terrain(); break; case 409: // load previous town/outdoor zone if (editing_town == true) { if (cur_town == 0) load_town(scenario.num_towns - 1); else load_town(cur_town - 1); start_town_edit(); } else { if (cur_out.x > 0) { x = cur_out.x - 1; y = cur_out.y; } if ((cur_out.x == 0) && (cur_out.y > 0)) { x = scenario.out_width - 1; y = cur_out.y - 1; } if ((cur_out.x == 0) && (cur_out.y == 0)) { x = scenario.out_width - 1; y = scenario.out_height - 1; } spot_hit.x = x; spot_hit.y = y; load_outdoors(spot_hit,0); augment_terrain(spot_hit); start_out_edit(); } break; case 410: // load next town/outdoor zone if (editing_town == true) { if (cur_town + 1 == scenario.num_towns) load_town(0); else load_town(cur_town + 1); start_town_edit(); } else { if ((cur_out.x < (scenario.out_width - 1)) && (cur_out.y <= (scenario.out_height - 1))) { x = cur_out.x + 1; y = cur_out.y; } if ((cur_out.x == (scenario.out_width - 1)) && (cur_out.y < (scenario.out_height - 1))) { x = 0; y = cur_out.y + 1; } if ((cur_out.x == (scenario.out_width - 1)) && (cur_out.y == (scenario.out_height - 1))) { x = 0; y = 0; } spot_hit.x = x; spot_hit.y = y; load_outdoors(spot_hit,0); augment_terrain(spot_hit); start_out_edit(); } break; case 411: // MENUITEM "Terrain Animations Play", 411 HMENU menu,big_menu; big_menu = GetMenu(mainPtr); menu = GetSubMenu(big_menu,4); if(play_anim == FALSE){ play_anim = TRUE; CheckMenuItem(menu,411,MF_BYCOMMAND | MF_CHECKED); } else{ play_anim = FALSE; CheckMenuItem(menu,411,MF_BYCOMMAND | MF_UNCHECKED); } break; case 412: // load outdoor zone above if (editing_town) break; if (cur_out.y > 0) { x = cur_out.x; y = cur_out.y - 1; } else { x = cur_out.x; y = scenario.out_height - 1; } spot_hit.x = x; spot_hit.y = y; load_outdoors(spot_hit,0); augment_terrain(spot_hit); start_out_edit(); break; case 413: // load outdoor zone below if (editing_town) break; if (cur_out.y == scenario.out_height - 1) { x = cur_out.x; y = 0; } else { x = cur_out.x; y = cur_out.y + 1; } spot_hit.x = x; spot_hit.y = y; load_outdoors(spot_hit,0); augment_terrain(spot_hit); start_out_edit(); break; case 414: // Repeat print of last file printed switch (last_file_printed){ case 0: start_data_dump(); break; case 1: scen_text_dump(); break; case 2: start_shopping_data_dump(); break; case 3: start_monst_data_dump(); break; case 4: start_spec_data_dump(); break; case 5: start_town_data_dump(); break; case 6: start_outdoor_data_dump(); break; case 7: object_scenario_data_dump(); break; } break; // Extra Help case 801: // help file WinHelp(mainPtr,"Scenario Editor.hlp",HELP_CONTENTS,0L); break; case 802: fancy_choice_dialog(986,0); break; // started case 803: fancy_choice_dialog(1000,0); break; // testing case 804: fancy_choice_dialog(1001,0); break; // distributing case 805: fancy_choice_dialog(1062,0); break; default: if ((overall_mode >= 60) || (editing_town == FALSE)) { give_error("You can only place items and individual monsters in town sections, not outdoors.","",0); break; } if ((item_hit >= 600) && (item_hit < 1000)) { item_hit -= 600; if (scen_item_list.scen_items[item_hit].variety == 0) { give_error("This item has its Variety set to No Item. You can only place items with a Variety set to an actual item type.","",0); return to_return; } overall_mode = 4; set_string("Place the item.","Select item location"); mode_count = item_hit; } // skip the type 0 monster, it is non-existent if ((item_hit >= 1001) && (item_hit <= 1255)) { // 1,255? overall_mode = 28; item_hit -= 1000; set_string("Place the monster.","Select monster location"); mode_count = item_hit; } /* if ((item_hit >= 1256) && (item_hit <= 1455)) { item_hit -= 1256; mode_count = item_hit; load_town(item_hit); start_town_edit(); // set_string("Loading the indicated town."," "); } */ break; } if ((item >= 100) && (item < 200) && (item != 118) && (item != 119)) change_made = TRUE; 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; }
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; }