diff --git a/Win32/Blades of Exile Char Editor/BLADPCED.CPP b/Win32/Blades of Exile Char Editor/BLADPCED.CPP deleted file mode 100644 index f390f061..00000000 --- a/Win32/Blades of Exile Char Editor/BLADPCED.CPP +++ /dev/null @@ -1,699 +0,0 @@ -// Blades of Exile Editor -// May God have mercy on all our souls. - -#include - -#include "stdlib.h" -#include "string.h" -#include "stdio.h" -#include "math.h" - -#include "global.h" -#include "graphics.h" -#include "editors.h" -#include "edfileio.h" -#include "edsound.h" -#include "dlogtool.h" -#include "edaction.h" -#include "graphutl.h" - -void check_game_done(); -void load_cursors(); -void set_cursor(HCURSOR which_curs); -void change_cursor(POINT where_curs); -void check_colors(); -void cursor_go(); -void cursor_stay(); -Boolean verify_restore_quit(short mode); -void max_window(HWND window); -void update_item_menu(short mode); -void check_cd_event(HWND hwnd,UINT message,UINT wparam,LONG lparam); - -scen_item_data_type scen_item_list; -short item_menus_lock=1; - -/* Mac stuff globals */ -RECT windRECT, Drag_RECT; -Boolean All_Done = FALSE; -short had_text_freeze = 0,num_fonts; -Boolean in_startup_mode = TRUE,app_started_normally = FALSE,file_in_mem = FALSE; -Boolean play_sounds = TRUE,first_startup_update = TRUE,party_in_scen = FALSE; -Boolean diff_depth_ok = FALSE,first_sound_played = FALSE,spell_forced = FALSE,startup_loaded = FALSE; -Boolean save_maps = FALSE,first_time = FALSE,palette_suspect = FALSE,window_in_front = TRUE; - -HWND sbar; - -Boolean bgm_on = FALSE,bgm_init = FALSE; - -Boolean gInBackground = FALSE; -long start_time; - -// Cursors -short current_cursor = 120; -HCURSOR arrow_curs[3][3], sword_curs, boot_curs, key_curs, target_curs,talk_curs,look_curs; - -RECT pc_area_buttons[6][4] ; // 0 - whole 1 - pic 2 - name 3 - stat strs 4,5 - later -RECT item_string_rects[24][4]; // 0 - name 1 - drop 2 - id 3 - -RECT pc_info_rect; // Frame that holds a pc's basic info and items -RECT name_rect; //Holds pc name inside pc_info_rect -RECT info_area_rect; -RECT hp_sp_rect; // Holds hit points and spells points for pc -RECT skill_rect; // Holds "Skills:" string -RECT pc_skills_rect[19]; //Holds current pc's skill levels -RECT status_rect; //Holds the string "Status:" -RECT pc_status_rect[10]; //Holds first 8 effects on pc -RECT traits_rect; //Holds the string "Traits:" -RECT pc_traits_rect[16]; //Holds pc traits -RECT pc_race_rect; //Holds current pc's race -RECT edit_rect[5][2]; //Buttons that bring up pc edit dialog boxs - -short store_flags[3]; -char town_strs[180][256]; - -/* Adventure globals */ -party_record_type party; -pc_record_type adven[6]; -outdoor_record_type outdoors[2][2]; -current_town_type c_town; -big_tr_type t_d; -stored_items_list_type t_i; -unsigned char out[96][96]; - unsigned char out_e[96][96]; -setup_save_type setup_save; -unsigned char misc_i[64][64],sfx[64][64]; - -short current_active_pc = 0; - -stored_items_list_type stored_items[3]; -stored_town_maps_type town_maps; -stored_outdoor_maps_type o_maps; - - -/* Display globals */ -short overall_mode = 45,current_spell_range; -Boolean first_update = TRUE,anim_onscreen = FALSE,frills_on = TRUE,sys_7_avail,suppress_stat_screen = FALSE; -short stat_window = 0,store_modifier; -Boolean monsters_going = FALSE; -short give_delays = 0; -Boolean dialog_not_toast = TRUE; - -// storage for dialogs -short store_chosen_pc; -short store_choice_mode; -location store_choice_loc; - -short town_size[3] = {64,48,24}; -short which_item_page[6] = {0,0,0,0,0,0}; // Remembers which of the 2 item pages pc looked at -short pixel_depth,dialog_answer; - - -// Spell casting globals -short store_mage = 0, store_priest = 0; -short store_mage_lev = 0, store_priest_lev = 0; -short store_spell_target = 6,pc_casting; -short num_targets_left = 0; -location spell_targets[8]; - - -/* Windoze stuff globals */ -Boolean cursor_shown = TRUE; -short store_pc_being_created; - -short ulx = 0, uly = 0; - -HWND mainPtr; -HWND force_dlog = NULL; -HFONT font,small_bold_font,italic_font,underline_font,bold_font,tiny_font; -HBITMAP bmap = NULL; -//HPALETTE hpal; -HDC main_dc,main_dc2,main_dc3; -HINSTANCE store_hInstance; -HACCEL accel; -BOOL event_handled; - -char szWinName[] = "Blades of Exile dialogs"; -char szAppName[] = "Blades of Exile Editor"; -char file_path_name[256]; - -Boolean block_erase = FALSE; - -long CALLBACK _export WndProc (HWND, UINT, WPARAM, LPARAM); -Boolean handle_menu (short, HMENU); - -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 1.1", - 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; -} - -long CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ -HDC hdc; -PAINTSTRUCT ps; -POINT press; -HMENU menu; - - switch (message) { - case WM_KEYDOWN: - if (hwnd != mainPtr) - check_cd_event(hwnd,message,wParam,lParam); - return 0; - break; - - case WM_CHAR: - if (hwnd != mainPtr) - check_cd_event(hwnd,message,wParam,lParam); - return 0; - break; - - case WM_LBUTTONDOWN: - cursor_stay(); - if (hwnd != mainPtr) - check_cd_event(hwnd,message,wParam,lParam); - else { - SetFocus(hwnd); - press = MAKEPOINT(lParam); - - All_Done = handle_action(press, wParam,lParam); - check_game_done(); - } - return 0; - break; - - - case WM_RBUTTONDOWN: - cursor_stay(); - if (hwnd != mainPtr) - check_cd_event(hwnd,message,wParam,lParam); - return 0; - break; - - case WM_ACTIVATE: - if (hwnd == mainPtr) { - if ((LOWORD(wParam) == WA_ACTIVE) ||(LOWORD(wParam) == WA_CLICKACTIVE)) { - window_in_front = TRUE; - } - if (LOWORD(wParam) == WA_INACTIVE) { - window_in_front = FALSE; - } - } - return 0; - - - case WM_MOUSEMOVE: - set_cursor(sword_curs); - return 0; - - case WM_PAINT: - hdc = BeginPaint(hwnd,&ps); - EndPaint(hwnd,&ps); - if (hwnd != mainPtr) - check_cd_event(hwnd,message,wParam,lParam); - else redraw_screen(); - return 0; - - - case WM_COMMAND: - if (hwnd == mainPtr) { - - menu = GetMenu(mainPtr); - handle_menu((short) LOWORD(wParam), menu); - check_game_done(); - } - else { - check_cd_event(hwnd,message,wParam,lParam); - } - return 0; - - - case WM_DESTROY: - case WM_CLOSE: - if (hwnd == mainPtr) { - lose_graphics(); - PostQuitMessage(0); - } - return 0; - case WM_QUIT: - if (hwnd == mainPtr){ - lose_graphics(); - PostQuitMessage(0); - } - break; - } - -return DefWindowProc(hwnd,message,wParam,lParam); -} - -void check_game_done() -{ - // through_sending(); - if (All_Done == TRUE) { - lose_graphics(); - PostQuitMessage(0); - } -} - -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; -} - -void load_cursors() -{ - sword_curs = LoadCursor(store_hInstance,MAKEINTRESOURCE(120)); - - set_cursor(sword_curs); - current_cursor = 124; -} - -void set_cursor(HCURSOR which_curs) -{ - SetCursor (which_curs); -} - - -void check_colors() -{ - short a,b; - - a = GetDeviceCaps(main_dc,BITSPIXEL); - b = GetDeviceCaps(main_dc,PLANES); - if (a * b < 8) { - MessageBox(mainPtr,"The Blades of Exile Editor is designed for 256 colors. The current graphics device is set for less. Exile 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); - } -} - -void cursor_go() -{ - if (in_startup_mode == TRUE) - return; - if (cursor_shown == TRUE) { - cursor_shown = FALSE; - showcursor(FALSE); - } -} - -void cursor_stay() -{ - if ((cursor_shown == FALSE) || (in_startup_mode == TRUE)) { - cursor_shown = TRUE; - showcursor(TRUE); - } -} - -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; -} - -void update_item_menu(short mode) -//mode 0 - display item menus 1 - lock menus -{ - short i,j; - - HMENU menu[10],big_menu; - char item_name[256]; - - big_menu = GetMenu(mainPtr); - - for (i = 0; i < 10; i++) - menu[i] = GetSubMenu(big_menu,3 + i); - for(j=0;j<10;j++){ //first let's clean the menu - DeleteMenu(menu[j],1000 + j,MF_BYCOMMAND); //If there is any dummy, flush it - for (i=0;i<40;i++) - DeleteMenu(menu[j],600+(40*j)+i,MF_BYCOMMAND); - } - switch(mode){ - case 0: - for (j = 0; j < 10; j++) { //then populate it - for (i = 0; i < 40; i++) { - sprintf(item_name, "%s",scen_item_list.scen_items[i + j * 40].full_name); - if ((i % 20 == 0) && (i > 0)) - AppendMenu(menu[j],MF_MENUBREAK | MF_BYCOMMAND | MF_ENABLED | MF_STRING, 600 + (40 * j) + i, item_name); - else AppendMenu(menu[j],MF_BYCOMMAND | MF_ENABLED | MF_STRING, 600 + (40 * j) + i, item_name); - } - } - break; - - case 1: - for (j = 0; j < 10; j++) //then lock menus - AppendMenu(menu[j],MF_MENUBREAK | MF_BYCOMMAND | MF_GRAYED | MF_STRING, 600 + (40 * j), "None"); - break; - } -} - -void max_window(HWND window) -{ - RECT main_rect,wind_rect; - short width,height; - - cursor_shown = TRUE; - showcursor(TRUE); - - GetWindowRect(GetDesktopWindow(),&main_rect); - GetWindowRect(window,&wind_rect); - width = main_rect.right - main_rect.left; - height = main_rect.bottom - main_rect.top; - MoveWindow(window,0,0,width,height,TRUE); - -} - -void check_cd_event(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam) -{ - POINT press; - short wind_hit = -1,item_hit = -1; - - switch (message) { - case WM_COMMAND: - if (LOWORD(wparam) == 150) - break; - cd_find_dlog(hwnd,&wind_hit,&item_hit); // item_hit is dummy - item_hit = (short) LOWORD(wparam); - break; - case WM_KEYDOWN: - wind_hit = cd_process_syskeystroke(hwnd, wparam, lparam,&item_hit); - break; - - case WM_CHAR: - wind_hit = cd_process_keystroke(hwnd, wparam, lparam,&item_hit); - break; - - case WM_LBUTTONDOWN: - press = MAKEPOINT(lparam); - wind_hit = cd_process_click(hwnd,press, wparam, lparam,&item_hit); - break; - case WM_RBUTTONDOWN: - press = MAKEPOINT(lparam); - wparam = wparam | MK_CONTROL; - wind_hit = cd_process_click(hwnd,press, wparam, lparam,&item_hit); - break; - - case WM_PAINT: - cd_redraw(hwnd); - break; - } - if (wind_hit < 0) - return; - switch (wind_hit) { - case -1: break; - case 917: edit_day_event_filter(item_hit); break; - case 970: case 971: case 972: case 973: display_strings_event_filter(item_hit); break; - case 991: display_pc_event_filter(item_hit); break; - case 996: display_alchemy_event_filter(item_hit); break; - case 1010: spend_xp_event_filter (item_hit); break; - case 1012: case 947: edit_gold_or_food_event_filter (item_hit); break; - case 1013: pick_race_abil_event_filter (item_hit); break; - case 1018: select_pc_event_filter (item_hit); break; - case 1024: edit_xp_event_filter (item_hit); break; - default: fancy_choice_dialog_event_filter (item_hit); break; - } -} diff --git a/Win32/Blades of Exile Char Editor/DLOGTOOL.CPP b/Win32/Blades of Exile Char Editor/DLOGTOOL.CPP deleted file mode 100644 index 8a821bc2..00000000 --- a/Win32/Blades of Exile Char Editor/DLOGTOOL.CPP +++ /dev/null @@ -1,1575 +0,0 @@ -#include - -#define ND 15 -#define NI 500 -#define NL 100 -#define NUM_DLOG_B 53 - -#include "string.h" - -#include "global.h" -#include "graphutl.h" -#include "stdio.h" -#include "edsound.h" -#include "dlogtool.h" -#include "graphics.h" - -extern Boolean play_sounds,cursor_shown,dialog_not_toast,block_erase; -extern HBITMAP mixed_gworld, pc_stats_gworld, item_stats_gworld, text_area_gworld; -extern HBITMAP storage_gworld,terrain_screen_gworld,text_bar_gworld,orig_text_bar_gworld,buttons_gworld; -extern HBITMAP party_template_gworld,items_gworld,tiny_obj_gworld,fields_gworld; -extern HBITMAP dlg_buttons_gworld,spec_scen_g; -extern HBITMAP pcs_gworld,dlogpics_gworld; -extern HFONT fantasy_font,font,italic_font,underline_font,bold_font,tiny_font,small_bold_font; -extern HWND mainPtr; -//extern HPALETTE hpal; -extern HDC main_dc; -extern HINSTANCE store_hInstance; -long CALLBACK WndProc (HWND, UINT, UINT, LONG); -extern HBRUSH bg[14]; - -// Necessary evil -extern HBITMAP anim_gworld,pcs_gworld; -extern HBITMAP map_gworld,mixed_gworld; -extern HBITMAP button_num_gworld; -extern HBITMAP terrain_screen_gworld, buttons_gworld, text_screen_gworld,text_bar_gworld,orig_text_bar_gworld; -extern HBITMAP pc_info_screen_gworld,orig_pc_info_screen_gworld,terrain_gworld, party_template_gworld; -extern HBITMAP monster_template_gworld; -extern HBITMAP startmsc_gworld; -extern short terrain_pic[256]; -extern short ulx,uly; - -extern HACCEL accel; -extern unsigned char m_pic_index_x[200]; -extern unsigned char m_pic_index_y[200]; -extern unsigned char m_pic_index[200]; - -short current_key = 0; -short dlg_keys[ND]; -short dlg_types[ND]; -HWND dlgs[ND]; -HWND dlg_parent[ND]; -short dlg_highest_item[ND]; -Boolean dlg_draw_ready[ND]; - -short item_dlg[NI]; -short item_number[NI]; -char item_type[NI]; -RECT item_rect[NI]; -short item_flag[NI]; -char item_active[NI]; -char item_key[NI]; -short item_label[NI]; -short item_label_loc[NI]; - -char text_long_str[10][256]; -char text_short_str[140][35]; -char labels[NL][25]; -Boolean label_taken[NL]; - -HWND edit_box = NULL; -HWND store_edit_parent; // kludgy -WNDPROC edit_proc,old_edit_proc; - -HDC dlg_force_dc = NULL; // save HDCs when dealing with dlogs - -short store_free_slot,store_dlog_num; -HWND store_parent; - -short available_dlog_buttons[NUM_DLOG_B] = {0,63,64,65,1,4,5,8, - 128, - 9, - 10, // 10 - 11,12,13, - 14,15,16,17,29, 51, - 60,61,62, // 20 - 66,69,70, 71,72,73,74,79, - 80,83,86,87,88, 91,92,93,99,100, - 101,102,104, 129,130,131,132,133,134,135,136,137}; -short button_type[150] = {1,1,4,5,1,1,0,0,1,1, - 1,1,1,1,1,1,1,1,8,8, - 9,9,9,1,1,2,1,6,7,1, - 1,12,1,1,2,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,1,1,1,2,1,1,1,2,2, // 50 - 1,1,1,1,1,1,2,3,1,1, - 1,1,1,1,2,2,2,2,2,1, - 1,1,1,1,2,2,1,1,1,2, - 0,1,1,1,14,13,12,12,12,1, - 1,1,1,2,1,2,2,2,2,1, // 100 - 2,2,2,2,2,2,2,2,2,2, - 2,2,2,2,2,2,2,2,1,1, - 1,1,1,1,1,1,1,1,0,0, - 0,0,0,0,0,0,0,0,0,0}; -char *button_strs[150] = {"Done ","Ask"," "," ","Keep", "Cancel","+","-","Buy","Leave", - "Get","1","2","3","4","5","6","Cast"," "," ", - " "," "," ","Buy","Sell","Other Spells","Buy x10"," "," ","Save", - "Race","Train","Items","Spells","Heal Party","1","2","3","4","5", - "6","7","8","9","10","11","12","13","14","15", - /*50*/ "16","Take","Create","Delete","Race/Special","Skill","Name","Graphic","Bash Door","Pick Lock", - "Leave","Steal","Attack","OK","Yes","No","Step In"," ","Record","Climb", - "Flee","Onward","Answer","Drink","Approach","Mage Spells","Priest Spells","Advantages","New Game","Land", - "Under","Restore","Restart","Quit","Save First","Just Quit","Rest","Read","Pull","Alchemy", - "17","Push","Pray","Wait","","","Delete","Graphic","Create","Give", - /*100*/ "Destroy","Pay","Free","Next Tip","Touch", "Open File","Create/Edit","Clear Special","Edit Abilities","Choose", - "Go Back","Create New","General","One Shots","Affect PCs","If-Thens","Town Specs","Out Specs","Advanced","Weapon Abil", - "General Abil.","NonSpell Use","Spell Usable","Reagents","Missiles","Abilities","Pick Picture","Animated","Enter","Burn", - "Insert","Remove","Accept","Refuse","Open","Close","Sit","Stand","","", - "18","19","20","Invisible!","","","","","",""}; - -short button_left_adj[150] = {0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, // 50 -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0, -0,0,0,0,0, 0,0,0,0,0}; -char button_def_key[150] = {0,0,20,21,'k', 24,0,0,0,0, - 'g','1','2','3','4', '5','6',0,0,0, - 0,0,0,0,0,' ',0,22,23,0, - 0,0,0,0,0,'1','2','3','4','5', - '6','7','8','9','a', 'b','c','d','e','f', - 'g',0,0,0,0,0,0,0,0,0, - 0,0,0,0,'y','n',0,'?','r',0, - 0,0,0,0,0,0,0,0,0, 0, - 0,0,0,0,0,0,0,0,0,0, - 'g',0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0 - }; - // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc - // 25-30 ctrl 1-6 31 - return - -short button_ul_x[15] = {0,46,0,126,0, 0,126,126,126,138, 166,0,0,126,172}; -short button_ul_y[15] = {0,0,132,23,46, 69,46,69,36,36, 36,23,92,92,0}; -short button_width[15] = {23,63,102,16,63, 63,63,63,6,14, 14,63,63,63,30}; -short button_height[15] = {23,23,23,13,23, 23,23,23,6,10,10,23,40,40,30}; - -BOOL CALLBACK dummy_dialog_proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -LRESULT CALLBACK fresh_edit_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); - -DLGPROC d_proc; - -extern char szAppName[]; -extern char szWinName[]; - -void cd_init_dialogs() -{ - short i; - - for (i = 0; i < ND; i++) { - dlg_keys[i] = -1; - dlg_types[i] = 0; - dlgs[i] = NULL; - dlg_highest_item[i] = 0; - } - for (i = 0; i < NI; i++) { - item_dlg[i] = -1; - } - for (i = 0; i < NL; i++) { - label_taken[i] = FALSE; - } - d_proc = dummy_dialog_proc; - edit_proc = fresh_edit_proc; -} - -long CALLBACK fresh_edit_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - - switch (message) { - case WM_KEYDOWN: - if (wParam == VK_RETURN) - SendMessage(store_edit_parent,WM_COMMAND,9,0); - if (wParam == VK_ESCAPE) - SendMessage(store_edit_parent,WM_COMMAND,8,0); -/* if (wParam == VK_RETURN) - SendMessage(store_edit_parent,WM_KEYDOWN,wParam,lParam); - if (wParam == VK_ESCAPE) - SendMessage(store_edit_parent,WM_KEYDOWN,wParam,lParam);*/ - break; - } - return CallWindowProc((WNDPROC) old_edit_proc,hwnd,message,wParam,lParam); -} - -short cd_create_dialog_parent_num(short dlog_num,short parent) -{ - short i; - - if ((parent == 0) || (parent == 1)) - return cd_create_dialog(dlog_num,mainPtr); - i = cd_get_dlg_index(parent); - if (i < 0) - return -1; - return cd_create_dialog(dlog_num,dlgs[i]); - -} - -short cd_create_dialog(short dlog_num,HWND parent) -{ - short i,free_slot = -1; - HWND dlg; - - if (parent != NULL) { - if (IsWindowEnabled(parent) == 0) - return -1; - } - - store_dlog_num = dlog_num; - store_parent = parent; - - for (i = 0; i < ND; i++) { - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - return -1; - } - for (i = 0; i < ND; i++) { - if (dlg_keys[i] < 0) { - free_slot = i; - i = 500; - } - } - if (free_slot < 0) - return -2; - current_key++; - dlg_keys[free_slot] = current_key; - dlg_types[free_slot] = dlog_num; - dlg_highest_item[free_slot] = 1; - dlg_draw_ready[free_slot] = FALSE; - dlgs[free_slot] = NULL; - - // first, create dummy dlog - store_free_slot = free_slot; - dlg = CreateDialog(store_hInstance,MAKEINTRESOURCE(dlog_num),0,(DLGPROC) d_proc); - - if (dlgs[free_slot] == NULL) { - play_sound(3); - return -3; - } - center_window(dlgs[free_slot]); - - - - dlg_parent[free_slot] = parent; - - switch (dlog_num) { - case 970: case 971: case 972: case 973: SetWindowText(dlgs[free_slot],"Blades of Exile"); break; - case 991: SetWindowText(dlgs[free_slot],"Character Statistics"); break; - case 996: SetWindowText(dlgs[free_slot],"Known Alchemy"); break; - case 998: SetWindowText(dlgs[free_slot],"Item Information"); break; - case 1012: SetWindowText(dlgs[free_slot],"How many?"); break; - case 1013: SetWindowText(dlgs[free_slot],"Race/Advantages/Disadvantages"); break; - - case 1010: SetWindowText(dlgs[free_slot],"Training a PC"); break; - case 1018: SetWindowText(dlgs[free_slot],"Select a PC"); break; - default: SetWindowText(dlgs[free_slot],"Blades of Exile"); break; - } - ShowWindow(dlgs[free_slot],SW_SHOW); - DestroyWindow(dlg); //Necesary? Dunno. - - if (dlg_parent[free_slot] != NULL) { - EnableWindow(dlg_parent[free_slot],FALSE); - } - dialog_not_toast = TRUE; - return 0; -} - -BOOL CALLBACK dummy_dialog_proc(HWND hDlg, UINT message, WPARAM, LPARAM) -{ - short i,j,k,free_slot = -1,free_item = -1; - int type,flag; - char item_str[256]; - Boolean str_stored = FALSE; - RECT dlg_rect; - short win_height = 0, win_width = 0; - short str_offset = 1; - - free_slot = store_free_slot; - - switch (message) { - case WM_INITDIALOG: - - // now, make a window, matching dialog - GetWindowRect(hDlg,&dlg_rect); - dlgs[store_free_slot] = CreateWindow (szWinName, - "Blades of Exile Dialog", - 0,// was visible - 0, - 0, - dlg_rect.right - dlg_rect.left, - dlg_rect.bottom - dlg_rect.top, - NULL, - NULL, - store_hInstance, - NULL); - // Now, give the window its items - for (i = 0; i < 200; i++) - if (GetDlgItem(hDlg,i) != NULL) { - GetDlgItemText(hDlg,i,item_str,256); - str_offset = 1; - dlg_highest_item[free_slot] = i; - str_stored = FALSE; - if (strlen((char *)item_str) == 0) { - sprintf((char *) item_str, "+"); - type = 3; - flag = 0; - str_stored = TRUE; - } - else if (item_str[0] == '+') { // default is framed text - type = 3; - flag = 1; - str_stored = TRUE; - } - else if (item_str[0] == '*') { - type = 3; - flag = 0; - str_stored = TRUE; - } - else if (item_str[0] == '~') { - type = 7; - flag = 0; - str_stored = TRUE; - } - else if (item_str[0] == '!') { - type = 4; - flag = 0; - str_stored = TRUE; - } - else if (item_str[0] == '=') { - type = 9; - flag = 1; - str_stored = TRUE; - } - else if (((item_str[0] >= 65) && (item_str[0] <= 122)) || (item_str[0] == '"')) { - type = 9; - flag = 0; - str_offset = 0; - str_stored = TRUE; - } - else if ((item_str[0] == '^') || (item_str[0] == '&')) { - type = (item_str[0] == '^') ? 10 : 11; - flag = 1; - //if (string_length((char *) item_str) > 55) - // flag = 2; - str_stored = TRUE; - } - else - { - //sscanf(item_str,"%d_%d",&type,&flag); - type = atoi(item_str); - flag = atoi(item_str+2); - } - - free_item = -1; - // find free item - switch (type) { - case 0: case 1: case 2: case 5: case 6: - for (j = 150; j < NI; j++) - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - break; - default: - if ((type == 9) || - ((str_stored == TRUE) && (strlen((char *) item_str) > 35))) { - for (j = 0; j < 10; j++) - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - } - else { - for (j = 10; j < 140; j++) - if (item_dlg[j] < 0) { - free_item = j; - j = NI + 1; - } - } - break; - } - - if (free_item >= 0) { - item_dlg[free_item] = store_dlog_num; - item_type[free_item] = type; - item_number[free_item] = i; - - item_rect[free_item] = get_item_rect(hDlg,i); - item_rect[free_item].top = item_rect[free_item].top / 2; - item_rect[free_item].left = item_rect[free_item].left / 2; - item_rect[free_item].bottom = item_rect[free_item].bottom / 2; - item_rect[free_item].right = item_rect[free_item].right / 2; - - /*if ((type != 5) && ((store_dlog_num >= 2000) || (store_dlog_num == 986))) { - item_rect[free_item].top = - (item_rect[free_item].top * 11) / 10; - item_rect[free_item].bottom = - (item_rect[free_item].bottom * 11) / 10; - }*/ - - item_flag[free_item] = flag; - item_active[free_item] = 1; - item_label[free_item] = 0; - item_label_loc[free_item] = -1; - item_key[free_item] = 0; - - switch (type) { - case 0: case 1: - if (item_flag[free_item] != 143) { - item_rect[free_item].right = item_rect[free_item].left + button_width[button_type[flag]]; - item_rect[free_item].bottom = item_rect[free_item].top + button_height[button_type[flag]]; - - item_key[free_item] = button_def_key[flag]; - if (type == 1) - item_key[free_item] = 31; - } - break; - case 2: - item_rect[free_item].right = item_rect[free_item].left + 14; - item_rect[free_item].bottom = item_rect[free_item].top + 10; - item_key[free_item] = 255; - break; - case 3: case 4: case 7: case 8: case 9: case 10: case 11: - sprintf(((free_item < 10) ? text_long_str[free_item] : text_short_str[free_item - 10]),""); - if (str_stored == TRUE) { - if (free_item < 10) { - sprintf(text_long_str[free_item],"%s", - (char *) (item_str + str_offset)); - for (k = 0; k < 256; k++) { - if (text_long_str[free_item][k] == '|') - text_long_str[free_item][k] = 13; - if (text_long_str[free_item][k] == '_') - text_long_str[free_item][k] = '"'; - } - // give text a little extra room - //if ((store_dlog_num >= 2000) || (store_dlog_num == 986)) - // item_rect[free_item].right += 20; - } - else { - sprintf(text_short_str[free_item - 10],"%-34s", - (char *) (item_str + str_offset)); - for (k = 0; k < 35; k++) { - if (text_short_str[free_item][k] == '|') - text_short_str[free_item][k] = 13; - if (text_short_str[free_item][k] == '_') - text_short_str[free_item][k] = '"'; - } - } - } - item_key[free_item] = 255; - break; - case 6: - edit_box = CreateWindow("edit",NULL,WS_CHILD | WS_BORDER | WS_VISIBLE, - item_rect[free_item].left,item_rect[free_item].top, - item_rect[free_item].right - item_rect[free_item].left, - max(22,item_rect[free_item].bottom - item_rect[free_item].top), - dlgs[free_slot],(HMENU) 150,store_hInstance,NULL); - store_edit_parent = dlgs[free_slot]; - old_edit_proc = (WNDPROC) GetWindowLong(edit_box,GWL_WNDPROC); - SetWindowLong(edit_box,GWL_WNDPROC,(LONG) edit_proc); - break; - } - win_height = max(win_height, item_rect[free_item].bottom + 28); - win_width = max(win_width, item_rect[free_item].right + 11); - - } - - } - MoveWindow(dlgs[free_slot],0,0,win_width,win_height,FALSE); - EndDialog(hDlg, 0); - return TRUE; - } - return TRUE; - } - -void cd_set_edit_focus() -{ if (edit_box != NULL) - SetFocus(edit_box); -} - -short cd_kill_dialog(short dlog_num,short parent_message) -{ - short i,which_dlg = -1; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - which_dlg = i; - if (which_dlg < 0) - return -1; - - for (i = 0; i < NI; i++) - if (item_dlg[i] == dlog_num) { - if (item_type[i] == 6) { - DestroyWindow(edit_box); - edit_box = NULL; - } - if (item_label[i] > 0) - label_taken[item_label_loc[i]] = FALSE; - item_dlg[i] = -1; - } - - if (dlg_parent[which_dlg] != NULL) { - EnableWindow(dlg_parent[which_dlg],TRUE); - - SetFocus(dlg_parent[which_dlg]); - SetWindowPos(dlg_parent[which_dlg],HWND_TOP,0,0,100,100, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW); - cd_set_edit_focus(); - } - - if (parent_message > 0) - SendMessage(dlg_parent[which_dlg],WM_COMMAND,parent_message,0); - -DestroyWindow(dlgs[which_dlg]); - dlg_keys[which_dlg] = -1; - dialog_not_toast = TRUE; - block_erase = TRUE; - return 0; -} - -short cd_process_click(HWND window,POINT the_point, WPARAM wparam, LPARAM,short *item) -{ - short i,which_dlg,dlg_num,item_id; - short dlog_key; - - if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlog_key)) < 0) - return -1; - - - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) - if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { - if ((PtInRect(&item_rect[item_id],the_point)) && (item_active[item_id] > 0) - && ((item_type[item_id] < 3) || (item_type[item_id] == 8) - || (item_type[item_id] == 10)|| (item_type[item_id] == 11))) { - *item = i; - if (MK_CONTROL & wparam) - *item += 100; - if (item_type[item_id] != 8) - cd_press_button(dlg_num,i); - return dlg_num; - } - } - return -1; -} - -short cd_process_syskeystroke(HWND window, WPARAM wparam, LPARAM, short *item) -{ - short i,which_dlg,dlg_num,dlg_key,item_id; - char char_hit; - - - if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlg_key)) < 0) - return -1; - // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc - // 25-30 ctrl 1-6 - - switch (wparam) { - case VK_ESCAPE: - char_hit = 24; - break; - case VK_LEFT: - char_hit = 20; - break; - case VK_UP: - char_hit = 22; - break; - case VK_RIGHT: - char_hit = 21; - break; - case VK_DOWN: - char_hit = 23; - break; - case VK_RETURN: - char_hit = 31; - break; - default: - return -1; - } - - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) - if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { - if ((item_key[item_id] == char_hit) && (item_active[item_id] > 0) - && ((item_type[item_id] < 3) || (item_type[item_id] == 8))) { - *item = i; - if (item_type[item_id] != 8) - cd_press_button(dlg_num,i); - return dlg_num; - } - } - // kludgy. If you get an escape and is isn't processed, make it an enter - if (wparam == VK_ESCAPE) { - char_hit = 31; - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) - if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { - if ((item_key[item_id] == char_hit) && (item_active[item_id] > 0) - && ((item_type[item_id] < 3) || (item_type[item_id] == 8))) { - *item = i; - if (item_type[item_id] != 8) - cd_press_button(dlg_num,i); - return dlg_num; - } - } - } - - return -1; -} - -short cd_process_keystroke(HWND window, WPARAM wparam, LPARAM, short *item) -{ - short i,which_dlg,dlg_num,dlg_key,item_id; - char char_hit; - - if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlg_key)) < 0) - return -1; - // specials ... 20 - <- 21 - -> 22 up 23 down 24 esc - // 25-30 ctrl 1-6 - - char_hit = (char) wparam; - - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) - if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) { - if ((item_key[item_id] == char_hit) && (item_active[item_id] > 0) - && ((item_type[item_id] < 3) || (item_type[item_id] == 8))) { - *item = i; - if (item_type[item_id] != 8) - cd_press_button(dlg_num,i); - return dlg_num; - } - } - return -1; -} - -void cd_init_button(short dlog_num,short item_num, short button_num, short status) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - if (item_type[item_index] > 1) { - play_sound(0); - return; - } - item_flag[item_index] = button_num; - item_active[item_index] = status; - item_rect[item_index].right = item_rect[item_index].left + button_width[button_num]; - item_rect[item_index].bottom = item_rect[item_index].top + button_width[button_num]; - item_key[item_index] = button_def_key[button_num]; - cd_draw_item(dlog_num,item_num); -} - -void cd_attach_key(short dlog_num,short item_num,char key) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if ((item_type[item_index] > 2) && (item_type[item_index] != 8)) { - play_sound(0); - return; - } - item_key[item_index] = key; -} - -void cd_set_pict(short dlog_num, short item_num, short pict_num) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - if (item_type[item_index] != 5) { - play_sound(0); - return; - } - item_flag[item_index] = pict_num; - if (pict_num == -1) - cd_erase_item(dlog_num,item_num); - else cd_draw_item(dlog_num,item_num); -} - -void cd_activate_item(short dlog_num, short item_num, short status) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - item_active[item_index] = status; - cd_draw_item(dlog_num,item_num); -} - -short cd_get_active(short dlog_num, short item_num) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return -1; - - return item_active[item_index]; -} - - -void cd_get_item_text(short dlog_num, short item_num, char *str) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return ; - if (item_type[item_index] == 6) { - //print_nums(0,0,GetWindowText(edit_box,str,255)); - if (edit_box != NULL) - GetWindowText(edit_box,str,255); - else sprintf(str,""); - //add_string_to_buf(str); - return; - } - if (item_index >= 150) { - play_sound(0); - return; - } - if (item_index < 10) - sprintf(str,"%s",text_long_str[item_index]); - else sprintf(str,"%s",text_short_str[item_index - 10]); -} - -void cd_get_text_edit_str(short, char *str) -{ - if (edit_box != NULL) - GetWindowText(edit_box,str,255); - else str[0] = 0; -} -// NOTE!!! Expects a c string -void cd_set_text_edit_str(short, char *str) -{ - if (edit_box != NULL) - SetWindowText(edit_box,str); -} -void cdsin(short dlog_num, short item_num, short num) -{ - cd_set_item_num( dlog_num, item_num, num); -} -void csit(short dlog_num, short item_num, char *str) -{ -cd_set_item_text( dlog_num, item_num, str); -} -void csp(short dlog_num, short item_num, short pict_num) -{ - cd_set_pict( dlog_num, item_num, pict_num); -} - - -void cd_set_item_text(short dlog_num, short item_num, char *str) -{ - short k,dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return ; - if (item_type[item_index] == 6) { - if (edit_box != NULL) - SetWindowText(edit_box,str); - return; - } - if (item_index >= 150) { - play_sound(0); - return; - } - if (item_index < 10) { - sprintf(text_long_str[item_index],"%s",str); - for (k = 0; k < 256; k++) { - if (text_long_str[item_index][k] == '|') - text_long_str[item_index][k] = 13; - if (text_long_str[item_index][k] == '_') - text_long_str[item_index][k] = '"'; - } - - } - else sprintf(text_short_str[item_index - 10],"%-34s",str); - cd_draw_item( dlog_num,item_num); -} - -void cd_set_item_num(short dlog_num, short item_num, short num) -{ - short dlg_index,item_index; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return ; - if (item_index >= 150) { - play_sound(0); - return; - } - if (item_index < 10) - sprintf(text_long_str[item_index],"%d",num); - else sprintf(text_short_str[item_index - 10],"%d",num); - cd_draw_item( dlog_num,item_num); -} - -void cd_set_flag(short dlog_num,short item_num,short flag) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - item_flag[item_index] = flag; - cd_draw_item(dlog_num,item_num); -} - -void cd_set_led(short dlog_num,short item_num,short state) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if (item_type[item_index] != 2) { - play_sound(0); - return; - } - item_flag[item_index] = state; - cd_draw_item(dlog_num,item_num); -} - -short cd_get_led(short dlog_num,short item_num) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return 0; - - if (item_type[item_index] != 2) { - play_sound(0); - return 0; - } - return item_flag[item_index]; -} - - -void cd_text_frame(short dlog_num,short item_num,short frame) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if (item_index >= 150) { - play_sound(0); - return; - } - item_flag[item_index] = frame; - cd_draw_item(dlog_num,item_num); -} - -void cd_add_label(short dlog_num, short item_num, char *label, short label_flag) -{ - short dlg_index,item_index,label_loc = -1; - short i; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - - if (item_label_loc[item_index] < 0) { - item_label[item_index] = label_flag; - for (i = 0; i < 100; i++) - if (label_taken[i] == FALSE) { - label_loc = i; - label_taken[i] = TRUE; - i = 100; - } - if (label_loc < 0) { - play_sound(0); - return; - } - item_label_loc[item_index] = label_loc; - } - else cd_erase_item(dlog_num,item_num + 100); - label_loc = item_label_loc[item_index]; - sprintf((char *) labels[label_loc],"%-24s",label); - if (item_active[item_index] > 0) - cd_draw_item(dlog_num,item_num); -} - -void cd_take_label(short dlog_num, short item_num) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - item_label[item_index] = 0; - label_taken[item_label_loc[item_index]] = FALSE; -} - -void cd_key_label(short dlog_num, short item_num,short loc) -{ - short dlg_index,item_index; - char str[10]; - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - sprintf((char *) str," "); - str[0] = item_key[item_index]; - cd_add_label(dlog_num,item_num, str, 7 + loc * 100); -} - -void cd_draw_item(short dlog_num,short item_num) -{ - short dlg_index,item_index,store_label; - HDC win_dc; - COLORREF colors[4] = {RGB(0,0,0),RGB(255,0,0),RGB(0,0,102),RGB(255,255,255)}; - //UINT c[4]; - RECT from_rect,to_rect; - HFONT old_font; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - if (dlg_draw_ready[dlg_index] == FALSE) - return; - - /*c[0] = GetNearestPaletteIndex(hpal,colors[0]); - c[1] = GetNearestPaletteIndex(hpal,colors[1]); - c[2] = GetNearestPaletteIndex(hpal,colors[2]); - c[3] = GetNearestPaletteIndex(hpal,colors[3]);*/ - win_dc = cd_get_dlog_dc(dlg_index); - old_font = (HFONT) SelectObject(win_dc,small_bold_font); - dlg_force_dc = win_dc; - - if (item_active[item_index] == 0) { - cd_erase_item(dlog_num,item_num); - cd_erase_item(dlog_num,item_num + 100); - } - else { - switch (item_type[item_index]) { - case 0: case 1: case 10: case 11: - if (item_flag[item_index] == 143) - break; - from_rect.top = button_ul_y[button_type[item_flag[item_index]]]; - from_rect.left = button_ul_x[button_type[item_flag[item_index]]]; - from_rect.bottom = from_rect.top + button_height[button_type[item_flag[item_index]]]; - from_rect.right = from_rect.left + button_width[button_type[item_flag[item_index]]]; - rect_draw_some_item(dlg_buttons_gworld,from_rect,(HBITMAP)win_dc,item_rect[item_index],0,2); - - SelectObject(win_dc,bold_font); - SetTextColor(win_dc,colors[2]); - if (item_type[item_index] < 2) - OffsetRect(&item_rect[item_index],-1 * button_left_adj[item_flag[item_index]],0); - if (item_type[item_index] < 2) { - char_win_draw_string(win_dc,item_rect[item_index], - (char *) (button_strs[item_flag[item_index]]),1,8); - } - else { - char_win_draw_string(win_dc,item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),1,8); - } - if (item_type[item_index] < 2) - OffsetRect(&item_rect[item_index],button_left_adj[item_flag[item_index]],0); - SetTextColor(win_dc,colors[0]); - - break; - - case 2: - switch (item_flag[item_index]) { - case 0: from_rect.left = 166; from_rect.top = 36; break; - case 1: from_rect.left = 152; from_rect.top = 36; break; - case 2: from_rect.left = 138; from_rect.top = 36; break; - } - from_rect.right = from_rect.left + 14; - from_rect.bottom = from_rect.top + 10; - rect_draw_some_item( dlg_buttons_gworld,from_rect,(HBITMAP) win_dc,item_rect[item_index],0,2); break; - break; - - case 3: case 4: case 7: case 8: case 9: - cd_erase_item(dlog_num,item_num); - SetTextColor(win_dc,colors[3]); - if ((item_type[item_index] == 3) || (item_type[item_index] == 9)) - SelectObject(win_dc,small_bold_font); - if (item_type[item_index] == 4) - SelectObject(win_dc,tiny_font); - if (item_type[item_index] == 7) - SelectObject(win_dc,bold_font); - if (item_flag[item_index] % 10 == 1) - cd_frame_item(dlog_num,item_num,2); - if (item_flag[item_index] >= 10) { - SetTextColor(win_dc,colors[1]); - } - - if (item_rect[item_index].bottom - item_rect[item_index].top < 20) { - item_rect[item_index].left += 3; - DrawText(win_dc,(char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]), -1, &item_rect[item_index], - DT_LEFT | DT_SINGLELINE | DT_VCENTER | DT_NOCLIP); - item_rect[item_index].left -= 3; - } - else { - InflateRect(&item_rect[item_index],-4,-4); - DrawText(win_dc,(char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]), -1, &item_rect[item_index], - DT_LEFT | DT_WORDBREAK | DT_NOCLIP); - InflateRect(&item_rect[item_index],4,4); - } - SetTextColor(win_dc,colors[0]); - break; - case 5: - if (item_flag[item_index] == -1) - cd_erase_item(dlog_num,item_num); - else draw_dialog_graphic(dlgs[dlg_index], item_rect[item_index], - item_flag[item_index],(item_flag[item_index] >= 2000) ? FALSE : TRUE,0); - break; - } - } - - if (item_label[item_index] != 0) { - store_label = item_label[item_index]; - if (store_label >= 1000) { - store_label -= 1000; - SelectObject(win_dc,bold_font); - } - else SelectObject(win_dc,tiny_font); - to_rect = item_rect[item_index]; - switch (store_label / 100) { - case 0: - to_rect.right = to_rect.left; - to_rect.left -= 2 * (store_label % 100); - break; - case 1: - to_rect.bottom = to_rect.top; - to_rect.top -= 2 * (store_label % 100); - break; - case 2: - to_rect.left = to_rect.right; - to_rect.right += 2 * (store_label % 100); - break; - case 3: - to_rect.top = to_rect.bottom; - to_rect.bottom += 2 * (store_label % 100); - break; - } - - if (to_rect.bottom - to_rect.top < 14) { - to_rect.bottom += (14 - (to_rect.bottom - to_rect.top)) / 2 + 1; - to_rect.top -= (14 - (to_rect.bottom - to_rect.top)) / 2 + 1; - } - //cd_erase_rect(dlog_num,to_rect); - if (item_active[item_index] != 0) { - SetTextColor(win_dc,colors[3]); - - DrawText(win_dc, (char *) labels[item_label_loc[item_index]], - -1, &to_rect, DT_LEFT | DT_SINGLELINE | DT_VCENTER); - SetTextColor(win_dc,colors[0]); - - } - } - - - SelectObject(win_dc,old_font); - cd_kill_dc(dlg_index,win_dc); - dlg_force_dc = NULL; - } - -void cd_initial_draw(short dlog_num) -{ - short i,which_dlg = -1; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - which_dlg = i; - if (which_dlg < 0) - return; - dlg_draw_ready[which_dlg] = TRUE; - - cd_erase_item(dlog_num, 0); - cd_draw(dlog_num); -} - -void cd_draw(short dlog_num) -{ - short i,which_dlg = -1; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - which_dlg = i; - if (which_dlg < 0) - return; - - for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) { - cd_draw_item(dlog_num,i); - } -} - -void cd_redraw(HWND window) -{ - short which_dlg,dlg_num,dlg_key; - - if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlg_key)) < 0) - return; - dlg_draw_ready[which_dlg] = TRUE; - cd_initial_draw(dlg_num); -} - -void cd_frame_item(short dlog_num, short item_num, short width) -{ - short dlg_index,item_index; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - frame_dlog_rect(dlgs[dlg_index], item_rect[item_index], width); -} - -void cd_erase_item(short dlog_num, short item_num) -// if item_num is 0, nail whole window -// item_num + 100 just erase label -{ - short i,dlg_index,item_index,store_label; - RECT to_fry; - HDC win_dc; - Boolean just_label = FALSE; - - if (item_num >= 100) { - item_num -= 100; - just_label = TRUE; - } - - if (item_num == 0) { - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - dlg_index = i; - GetWindowRect(dlgs[dlg_index],&to_fry); - OffsetRect(&to_fry,-1 * to_fry.left,-1 * to_fry.top); - } - else { - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - to_fry = item_rect[item_index]; - if (just_label == TRUE) { - if (item_label[item_index] != 0) { - store_label = item_label[item_index]; - if (store_label >= 1000) - store_label -= 1000; - - switch (store_label / 100) { - case 0: - to_fry.right = to_fry.left; - to_fry.left -= 2 * (store_label % 100); - break; - case 1: - to_fry.bottom = to_fry.top; - to_fry.top -= 2 * (store_label % 100); - break; - case 2: - to_fry.left = to_fry.right; - to_fry.right += 2 * (store_label % 100); - break; - case 3: - to_fry.top = to_fry.bottom; - to_fry.bottom += 2 * (store_label % 100); - break; - } - if ((i = 12 - (to_fry.bottom - to_fry.top)) > 0) { - // adjust rect ... but doesn't work for bold letters - to_fry.bottom += i / 2; - to_fry.bottom++; // extra pixel to get dangly letters - to_fry.top -= i / 2; - } - } - } - InflateRect(&to_fry,1,1); - - } - if (dlg_draw_ready[dlg_index] == FALSE) - return; - win_dc = cd_get_dlog_dc(dlg_index); - paint_pattern((HBITMAP)win_dc,2,to_fry,0); - cd_kill_dc(dlg_index,win_dc); -} - -void cd_erase_rect(short dlog_num,RECT to_fry) -{ - short dlg_index; - HDC win_dc; - - if ((dlg_index = cd_get_dlg_index(dlog_num)) < 0) - return; - if (dlg_draw_ready[dlg_index] == FALSE) - return; - - win_dc = cd_get_dlog_dc(dlg_index); - paint_pattern((HBITMAP)win_dc,2,to_fry,0); - cd_kill_dc(dlg_index,win_dc); -} - -void cd_press_button(short dlog_num, short item_num) -{ - short dlg_index,item_index; - long dummy; - HDC win_dc; - RECT from_rect; - COLORREF colors[3] = {RGB(0,0,0),RGB(0,0,112),RGB(0,255,255)}; - //UINT c[3]; - - if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0) - return; - // no press action for redio buttons - if ((item_type[item_index] == 2) || (item_flag[item_index] == 143)) { - play_sound(34); - return; - } - - /*c[0] = GetNearestPaletteIndex(hpal,colors[0]); - c[1] = GetNearestPaletteIndex(hpal,colors[1]); - c[2] = GetNearestPaletteIndex(hpal,colors[2]);*/ - win_dc = cd_get_dlog_dc(dlg_index); - - from_rect.top = button_ul_y[button_type[item_flag[item_index]]]; - from_rect.left = button_ul_x[button_type[item_flag[item_index]]]; - from_rect.bottom = from_rect.top + button_height[button_type[item_flag[item_index]]]; - from_rect.right = from_rect.left + button_width[button_type[item_flag[item_index]]]; - OffsetRect(&from_rect,button_width[button_type[item_flag[item_index]]],0); - - rect_draw_some_item(dlg_buttons_gworld,from_rect,(HBITMAP) win_dc,item_rect[item_index],0,2); - - SelectObject(win_dc,bold_font); - SetTextColor(win_dc,colors[2]); - if (item_type[item_index] < 2) - OffsetRect(&item_rect[item_index],-1 * button_left_adj[item_flag[item_index]],0); - if (item_type[item_index] < 2) { - char_win_draw_string(win_dc,item_rect[item_index], - (char *) (button_strs[item_flag[item_index]]),1,8); - } - else { - char_win_draw_string(win_dc,item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),1,8); - } - if (item_type[item_index] < 2) - OffsetRect(&item_rect[item_index],button_left_adj[item_flag[item_index]],0); - - if (play_sounds == TRUE) { - play_sound(37); - Delay(6,&dummy); - } - else Delay(10,&dummy); - - OffsetRect(&from_rect,-1 * button_width[button_type[item_flag[item_index]]],0); - rect_draw_some_item(dlg_buttons_gworld,from_rect,(HBITMAP)win_dc,item_rect[item_index],0,2); - - SelectObject(win_dc,bold_font); - SetTextColor(win_dc,colors[1]); - if (item_type[item_index] < 2) - OffsetRect(&item_rect[item_index],-1 * button_left_adj[item_flag[item_index]],0); - if (item_type[item_index] < 2) { - char_win_draw_string(win_dc,item_rect[item_index], - (char *) (button_strs[item_flag[item_index]]),1,8); - } - else { - char_win_draw_string(win_dc,item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : - text_short_str[item_index - 10]),1,8); - } - if (item_type[item_index] < 2) - OffsetRect(&item_rect[item_index],button_left_adj[item_flag[item_index]],0); - - SelectObject(win_dc,font); - SetTextColor(win_dc,colors[0]); - - cd_kill_dc(dlg_index,win_dc); - } - -// LOW LEVEL - -short cd_get_indices(short dlg_num, short item_num, short *dlg_index, short *item_index) -{ - if ((*dlg_index = cd_get_dlg_index(dlg_num)) < 0) { - return -1; - } - if ((*item_index = cd_get_item_id(dlg_num,item_num)) < 0) { - return -1; - } - return 0; - } - -short cd_get_dlg_index(short dlog_num) -{ - short i; - - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) - return i; - return -1; -} - -short cd_find_dlog(HWND window, short *dlg_num, short *dlg_key) -{ - short i; - for (i = 0; i < ND; i++) - if ((dlg_keys[i] >= 0) && (dlgs[i] == window)) { - *dlg_num = dlg_types[i]; - *dlg_key = dlg_keys[i]; - return i; - } - return -1; -} - -short cd_get_item_id(short dlg_num, short item_num) -{ - short i; - - for (i = 0; i < NI; i++) - if ((item_dlg[i] == dlg_num) && (item_number[i] == item_num)) - return i; - return -1; -} - -HDC cd_get_dlog_dc(short which_slot) -{ - HDC win_dc; - - win_dc = GetDC(dlgs[which_slot]); - - //SelectPalette(win_dc,hpal,0); - SetBkMode(win_dc,TRANSPARENT); - return win_dc; - } - -void cd_kill_dc(short which_slot,HDC hdc) -{ - fry_dc(dlgs[which_slot],hdc); -} - -// External graphics tools (huh huh huh ... tool ... huh huh huh) - -void center_window(HWND window) -{ - RECT main_rect,wind_rect; - short width,height; - - cursor_shown = TRUE; - showcursor(TRUE); - - GetWindowRect(GetDesktopWindow(),&main_rect); - GetWindowRect(window,&wind_rect); - width = wind_rect.right - wind_rect.left; - height = wind_rect.bottom - wind_rect.top; - MoveWindow(window,((main_rect.right - main_rect.left) - width) / 2, - ((main_rect.bottom - main_rect.top) - height) / 2,width,height,TRUE); - -} - -RECT get_item_rect(HWND hDlg, short item_num) -{ - HWND item; - RECT big_rect,small_rect; - - item = GetDlgItem(hDlg, item_num); - GetWindowRect(hDlg,&big_rect); - GetWindowRect(item,&small_rect); - OffsetRect(&small_rect, -1 * big_rect.left - 7, -1 * big_rect.top - 7); - small_rect.right += 2; - small_rect.bottom += 2; - return small_rect; -} - - -void frame_dlog_rect(HWND hDlg, RECT rect, short val) -{ - HDC hdc; - HPEN dpen,lpen,old_pen; - COLORREF x = RGB(0,204,255),y = RGB(0,204,255);//y = RGB(119,119,119); - //UINT c; - Boolean keep_dc = FALSE; - - InflateRect(&rect,val,val); - - if (hDlg == mainPtr) { - keep_dc = TRUE; - hdc = main_dc; - OffsetRect(&rect,ulx,uly); - } - else if (dlg_force_dc != NULL) { - hdc = dlg_force_dc; - keep_dc = TRUE; - } - else hdc = GetDC(hDlg); - if (hdc == NULL) { - play_sound(0); - return; - } - //SelectPalette(hdc,hpal,0); - //c = GetNearestPaletteIndex(hpal,x); - lpen = CreatePen(PS_SOLID,1,x); - //c = GetNearestPaletteIndex(hpal,y); - dpen = CreatePen(PS_SOLID,1,y); - old_pen = (HPEN) SelectObject(hdc,dpen); - MoveToEx(hdc,rect.left,rect.top, NULL); - LineTo(hdc,rect.right,rect.top); - SelectObject(hdc,lpen); - LineTo(hdc,rect.right,rect.bottom); - LineTo(hdc,rect.left,rect.bottom); - SelectObject(hdc,dpen); - LineTo(hdc,rect.left,rect.top); - SelectObject(hdc,old_pen); - if (keep_dc == FALSE) - fry_dc(hDlg,hdc); - DeleteObject(dpen); - DeleteObject(lpen); -} - -void draw_dialog_graphic(HWND hDlg, RECT rect, short which_g, Boolean do_frame,short win_or_gworld) -// win_or_gworld: 0 - window 1 - an HBITMAP -// 1 means hDlg is actually an HBITMAP variable! -// 0 - 300 number of terrain graphic -// 400 + x - monster graphic num -// 600 + x item graphic -// 700 + x dlog graphic -// 800 + x pc graphic -// 900 + x B&W graphic -// 950 null item -// 1000 + x Talking face -// 1100 - item info help -// 1200 - pc screen help -// 1300 - combat ap -// 1400-1402 - button help -// 1500 - stat symbols help -// 1600 + x - B&W maps -// 1700 + x - anim graphic -{ - RECT from2 = {0,0,36,36}; - RECT from_rect = {0,0,28, 36}; - RECT pc_info_from = {0,127,106,157}; - RECT item_info_from = {174,0,312,112}; - RECT button_help_from = {0,0,320,100}; - RECT large_scen_from = {0,0,64,64}; - - HBITMAP from_gworld; - short draw_dest = 2; - HDC hdc; - - - - if (win_or_gworld == 1) - draw_dest = 0; - - if (which_g < 0) - return; - - if (which_g >= 3000) - do_frame = FALSE; - which_g = which_g % 3000; - - if (win_or_gworld == 0) { - if (dlg_force_dc != NULL) - hdc = dlg_force_dc; - else hdc = GetDC(hDlg); - //SelectPalette(hdc,hpal,0); - } - if (which_g == 950) { // Empty. Maybe clear space. - if (win_or_gworld == 0) { - paint_pattern((HBITMAP)hdc,2,rect,0); - } - if (dlg_force_dc == NULL) - fry_dc(hDlg, hdc); - return; - } - - switch (which_g / 100) { - - case 7: // dialog - which_g -= 700; - from_gworld = dlogpics_gworld; - OffsetRect(&from2,36 * (which_g % 4),36 * (which_g / 4)); - rect_draw_some_item(from_gworld,from2,(HBITMAP) ((win_or_gworld == 1) ? (HBITMAP)hDlg: (HBITMAP)hdc) - ,rect,0,draw_dest); - break; - case 11: // item info help - from_rect = item_info_from; - rect.right = rect.left + from_rect.right - from_rect.left; - rect.bottom = rect.top + from_rect.bottom - from_rect.top; - rect_draw_some_item(mixed_gworld,from_rect,(HBITMAP) ((win_or_gworld == 1) ? (HBITMAP)hDlg: (HBITMAP)hdc) - ,rect,0,draw_dest); - break; - case 12: // item info help - from_rect = pc_info_from; - rect.right = rect.left + pc_info_from.right - pc_info_from.left; - rect.bottom = rect.top + pc_info_from.bottom - pc_info_from.top; - rect_draw_some_item(mixed_gworld,from_rect,(HBITMAP) ((win_or_gworld == 1) ? (HBITMAP)hDlg: (HBITMAP)hdc) - ,rect,0,draw_dest); - break; - case 14: // button help - which_g -= 1400; - if (which_g >= 10) { - from_gworld = load_pict(900 + which_g,hdc); - from_rect = large_scen_from; - OffsetRect(&from_rect,64 * (which_g % 10),0); - rect_draw_some_item(from_gworld,from_rect,(HBITMAP) ((win_or_gworld == 1) ? (HBITMAP)hDlg: (HBITMAP)hdc) - ,rect,0,draw_dest); - DeleteObject(from_gworld); - break; - } - from_gworld = load_pict(1401,hdc); - from_rect = button_help_from; - rect.top += 10; - rect.right = rect.left + from_rect.right; - rect.bottom = rect.top + from_rect.bottom; - OffsetRect(&from_rect,0,100 * which_g); - rect_draw_some_item(from_gworld,from_rect,(HBITMAP) ((win_or_gworld == 1) ? (HBITMAP)hDlg: (HBITMAP)hdc) - ,rect,0,draw_dest); - DeleteObject(from_gworld); - break; - - - case 16: - which_g -= 1600; - from_gworld = load_pict(851,hdc); - from_rect.right = 32; - from_rect.bottom = 32; - OffsetRect(&from_rect,32 * (which_g % 5),32 * (which_g / 5)); - rect.right = rect.left + 32; - rect.bottom = rect.top + 32; - rect_draw_some_item(from_gworld,from_rect,(HBITMAP) ((win_or_gworld == 1) ? (HBITMAP) (hDlg): (HBITMAP) hdc) - ,rect,0,draw_dest); - DeleteObject(from_gworld); - break; - - - - } - - if ((win_or_gworld == 0) && (dlg_force_dc == NULL)) - fry_dc(hDlg, hdc); - if ((win_or_gworld == 0) && (do_frame == TRUE)){ - rect.bottom--; rect.right--; - frame_dlog_rect(hDlg,rect,3); - } -} - -void showcursor(Boolean a) -{ - short i; - i = ShowCursor(a); - if (a == FALSE) - while (i >= 0) - i = ShowCursor(FALSE); - if (a == TRUE) - while (i < 0) - i = ShowCursor(TRUE); - } - -void ModalDialog() -{ - MSG msg; - - while ((dialog_not_toast == TRUE) && (GetMessage(&msg,NULL,0,0))) { - if (!TranslateAccelerator(mainPtr, accel, &msg)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } -} - -RECT calc_rect(short i, short j) -{ - RECT base_rect = {0,0,28,36}; - - OffsetRect(&base_rect,i * 28, j * 36); - return base_rect; -} diff --git a/Win32/Blades of Exile Char Editor/DLOGTOOL.H b/Win32/Blades of Exile Char Editor/DLOGTOOL.H deleted file mode 100644 index 1e73e689..00000000 --- a/Win32/Blades of Exile Char Editor/DLOGTOOL.H +++ /dev/null @@ -1,52 +0,0 @@ -void cd_set_flag(short dlog_num,short item_num,short flag); -void cd_erase_rect(short dlog_num,RECT to_fry); -short cd_get_led(short dlog_num,short item_num); -void frame_di(HWND hDlg, short item_num, short val); -void cd_kill_dc(short which_slot,HDC hdc); -HDC cd_get_dlog_dc(short which_slot); -short cd_get_active(short dlog_num, short item_num); -short cd_create_dialog_parent_num(short dlog_num,short parent); -void cd_set_edit_focus(); -void cd_init_dialogs(); -short cd_create_dialog(short dlog_num,HWND parent) ; -short cd_kill_dialog(short dlog_num,short parent_message); -short cd_process_click(HWND window,POINT the_point, UINT wparam, LONG lparam,short *item); -short cd_process_syskeystroke(HWND window,UINT wparam, LONG lparam,short *item); -short cd_process_keystroke(HWND window,UINT wparam, LONG lparam,short *item); -void cd_init_button(short dlog_num,short item_num, short button_num, short status); -void cd_attach_key(short dlog_num,short item_num,char key); -void cd_set_pict(short dlog_num, short item_num, short pict_num); -void cd_activate_item(short dlog_num, short item_num, short status); -void cd_get_item_text(short dlog_num, short item_num, char *str); -void cd_set_item_text(short dlog_num, short item_num, char *str); -void cd_set_item_num(short dlog_num, short item_num, short num); -void cd_set_led(short dlog_num,short item_num,short state); -void cd_text_frame(short dlog_num,short item_num,short frame); -void cd_add_label(short dlog_num, short item_num, char *label, short label_flag); -void cd_take_label(short dlog_num, short item_num); -void cd_key_label(short dlog_num, short item_num,short loc); -void cd_draw_item(short dlog_num,short item_num); -void cd_initial_draw(short dlog_num); -void cd_draw(short dlog_num); -void cd_redraw(HWND window); -void cd_frame_item(short dlog_num, short item_num, short width); -void cd_erase_item(short dlog_num, short item_num); -void cd_press_button(short dlog_num, short item_num); -short cd_get_indices(short dlg_num, short item_num, short *dlg_index, short *item_index); -short cd_get_dlg_index(short dlog_num); -short cd_find_dlog(HWND window, short *dlg_num, short *dlg_key); -short cd_get_item_id(short dlg_num, short item_num); -void center_window(HWND window); -RECT get_item_rect(HWND hDlg, short item_num); -void frame_dlog_rect(HWND hDlg, RECT rect, short val); -void draw_dialog_graphic(HWND hDlg, RECT rect, short which_g, Boolean do_frame,short win_or_gworld) ; -void showcursor(Boolean a); - -void cd_get_text_edit_str(short dlog_num, char *str); -void cd_set_text_edit_str(short dlog_num, char *str); -void cdsin(short dlog_num, short item_num, short num); -void csit(short dlog_num, short item_num, char *str); -void csp(short dlog_num, short item_num, short pict_num); -void ModalDialog(); - -RECT calc_rect(short i, short j); diff --git a/Win32/Blades of Exile Char Editor/EDACTION.CPP b/Win32/Blades of Exile Char Editor/EDACTION.CPP deleted file mode 100644 index 8be46a00..00000000 --- a/Win32/Blades of Exile Char Editor/EDACTION.CPP +++ /dev/null @@ -1,653 +0,0 @@ -#include - -#include "stdio.h" - -#include "graphics.h" -#include "global.h" -#include "editors.h" -#include "edfileio.h" -#include "edaction.h" -#include "edsound.h" -#include "dlogtool.h" -#include "graphutl.h" - -/* Adventure globals */ -extern party_record_type party; -extern pc_record_type adven[6]; -extern outdoor_record_type outdoors[2][2]; -extern current_town_type c_town; -extern big_tr_type t_d; -extern stored_items_list_type t_i; -extern unsigned char out[96][96] ; -extern unsigned char out_e[96][96]; -extern setup_save_type setup_save; -extern stored_items_list_type stored_items[3]; -extern stored_town_maps_type maps; -extern stored_outdoor_maps_type o_maps; -extern pascal Boolean cd_event_filter(); - -extern Boolean dialog_not_toast; - -extern HWND mainPtr; -extern Boolean file_in_mem; -extern short current_cursor,dialog_answer; - -extern HBITMAP pc_gworld; -extern HCURSOR sword_curs; -extern Boolean diff_depth_ok; -extern RECT edit_rect[5][2]; - - -short which_pc_displayed,store_pc_trait_mode,store_which_to_edit; -extern short current_active_pc; -char empty_string[256] = " "; -extern RECT pc_area_buttons[6][4],name_rect; // 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 - - -short store_trait_mode,store_train_pc; - -extern short ulx,uly; -// Variables for spending xp - Boolean talk_done = FALSE; - long val_for_text; - Boolean keep_change = FALSE; - short store_skills[20],store_h,store_sp,i,which_skill,store_skp = 10000,store_g = 10000; - - -short skill_cost[20] = {3,3,3,2,2,2, 1,2,2,6, - 5, 1,2,4,2,1, 4,2,5,0}; -short skill_max[20] = {20,20,20,20,20,20,20,20,20,7, - 7,20,20,10,20,20,20,20,20}; -short skill_g_cost[20] = {50,50,50,40,40,40,30,50,40,250, - 250,25,100,200,30,20,100,80,0,0}; -short skill_bonus[21] = {-3,-3,-2,-1,0,0,1,1,1,2, - 2,2,3,3,3,3,4,4,4,5,5}; -pc_record_type *store_xp_pc; - -//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 - -Boolean handle_action(POINT the_point, UINT wparam, LONG lparam ) -//short mode; // ignore, -{ - short i; - - Boolean to_return = FALSE; - Boolean ctrl_key = FALSE; - Boolean right_button = FALSE; - - if (lparam != -1) { - the_point.x -= ulx; - the_point.y -= uly; - } - if (lparam == -2) - right_button = TRUE; - if (MK_CONTROL & wparam) - ctrl_key = TRUE; - - if (file_in_mem == FALSE) - return FALSE; - - - for (i = 0; i < 6; i++) - if ((PtInRect(&pc_area_buttons[i][0],the_point) == TRUE) && - (adven[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(&edit_rect[i][0],the_point) == TRUE) && - (adven[current_active_pc].main_status > 0)) { - do_button_action(0,i + 10); - 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(&adven[current_active_pc],0,0); - break; - case 3: - spend_xp(current_active_pc,1,0); - break; - case 4: - edit_xp(&adven[current_active_pc]); - - break; - } - } - for (i = 0; i < 24; i++) - if ((PtInRect(&item_string_rects[i][1],the_point) == TRUE) && // drop item - (adven[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(&item_string_rects[i][2],the_point) == TRUE) && // identify item - (adven[current_active_pc].items[i].variety > 0)) { - flash_rect(item_string_rects[i][2]); - adven[current_active_pc].items[i].item_properties = adven[current_active_pc].items[i].item_properties | 1; - draw_items(1); - } - - return to_return; -} - -void flash_rect(RECT to_flash) -{ - - long dummy; - HDC hdc; - - hdc = GetDC(mainPtr); - SetViewportOrgEx( hdc,ulx,uly, NULL); - InvertRect (hdc,&to_flash); - play_sound(37); - Delay(5,&dummy); - InvertRect (hdc,&to_flash); - fry_dc(mainPtr,hdc); -} - -void edit_gold_or_food_event_filter (short) -{ - char get_text[256]; - - int tmp; - - cd_get_text_edit_str((store_which_to_edit == 0) ? 1012 : 947,(char *) get_text); - dialog_answer = 0; - sscanf((char *) get_text,"%d",&tmp); - dialog_answer = tmp; - dialog_not_toast = FALSE; -} - -void edit_gold_or_food(short which_to_edit) -//0 - gold 1 - food -{ - char sign_text[256]; - - store_which_to_edit = which_to_edit; - - make_cursor_sword(); - - cd_create_dialog((which_to_edit == 0) ? 1012 : 947,mainPtr); - - sprintf((char *) sign_text,"%d",(short) ((which_to_edit == 0) ? party.gold : party.food)); - cd_set_text_edit_str((which_to_edit == 0) ? 1012 : 947,(char *) sign_text); - - cd_set_edit_focus(); - while (dialog_not_toast) - ModalDialog(); - - cd_kill_dialog((which_to_edit == 0) ? 1012 : 947,0); - - if (dialog_answer < 0) - dialog_answer = -1; - else dialog_answer = minmax(0,25000,dialog_answer); - - if (dialog_answer >= 0) { - if (which_to_edit == 0) - party.gold = dialog_answer; - else party.food = dialog_answer; - } -} - -void edit_day_event_filter (short) -{ - char get_text[256]; - int tmp; - - cd_get_text_edit_str(917,(char *) get_text); - sscanf((char *) get_text,"%d",&tmp); - dialog_answer = tmp; - dialog_not_toast = FALSE; -} - -void edit_day() -{ - - - char sign_text[256]; - - - - make_cursor_sword(); - - cd_create_dialog(917,mainPtr); - - sprintf((char *) sign_text,"%d",(short) ( ((party.age) / 3700) + 1)); - cd_set_text_edit_str(917,(char *) sign_text); - - cd_set_edit_focus(); - while (dialog_not_toast) - ModalDialog(); - - - cd_kill_dialog(917,0); - - dialog_answer = minmax(1,500,dialog_answer)-1; - - party.age = (long) (3700) * (long) (dialog_answer); -} - - -void put_pc_graphics() -{ - short i; - - for (i = 3; i < 65; i++) { - if (((store_trait_mode == 0) && (adven[which_pc_displayed].mage_spells[i - 3] == TRUE)) || - ((store_trait_mode == 1) && (adven[which_pc_displayed].priest_spells[i - 3] == TRUE))) - cd_set_led(991,i,1); - else cd_set_led(991,i,0); - } - - cd_set_item_text(991,69,adven[which_pc_displayed].name); -} -Boolean display_pc_event_filter (short item_hit) -{ - short pc_num; - - pc_num = which_pc_displayed; - switch (item_hit) { - case 1: case 65: - dialog_not_toast = FALSE; - break; - - case 66: - do { - pc_num = (pc_num == 0) ? 5 : pc_num - 1; - } while (adven[pc_num].main_status == 0); - which_pc_displayed = pc_num; - put_pc_graphics(); - break; - case 67: - do { - pc_num = (pc_num == 5) ? 0 : pc_num + 1; - } while (adven[pc_num].main_status == 0); - which_pc_displayed = pc_num; - put_pc_graphics(); - break; - - default: - if (store_trait_mode == 0) - adven[which_pc_displayed].mage_spells[item_hit - 3] = - 1 - adven[which_pc_displayed].mage_spells[item_hit - 3]; - else - adven[which_pc_displayed].priest_spells[item_hit - 3] = - 1 - adven[which_pc_displayed].priest_spells[item_hit - 3]; - put_pc_graphics(); - break; - } - return FALSE; -} - -void display_pc(short pc_num,short mode,short) -{ - short i; - char label_str[256]; - - if (adven[pc_num].main_status == 0) { - for (pc_num = 0; pc_num < 6; pc_num++) - if (adven[pc_num].main_status == 1) - break; - } - which_pc_displayed = pc_num; - store_trait_mode = mode; - - make_cursor_sword(); - - cd_create_dialog_parent_num(991,0); - - for (i = 3; i < 65; i++) { - get_str(label_str,(mode == 0) ? 7 : 8,(i - 3) * 2 + 1); - cd_add_label(991,i,(char *)label_str,46); - } - put_pc_graphics(); - - cd_set_pict(991,2,714 + mode); - while (dialog_not_toast) - ModalDialog(); - - cd_kill_dialog(991,0); -} - - -Boolean display_alchemy_event_filter (short item_hit) -{ - short i; - - switch (item_hit) { - case 1: case 3: - dialog_not_toast = FALSE; - break; - default: - party.alchemy[item_hit - 4] = 1 - party.alchemy[item_hit - 4]; - break; - - } - for (i = 0; i < 20; i++) { - if (party.alchemy[i] > 0) - cd_set_led(996,i + 4,1); - else cd_set_led(996,i + 4,0); - } - return FALSE; -} - -void display_alchemy() -{ - short i; - char *alch_names[] = {"Weak Curing Potion (1)","Weak Healing Potion (1)","Weak Poison (1)", - "Weak Speed Potion (3)","Medium Poison (3)", - "Medium Heal Potion (4)","Strong Curing (5)","Medium Speed Potion (5)", - "Graymold Salve (7)","Weak Power Potion (9)", - "Potion of Clarity (9)","Strong Poison (10)","Strong Heal Potion (12)","Killer Poison (12)", - "Resurrection Balm (9)","Medium Power Potion (14)","Knowledge Brew (19)", - "Strong Strength (10)","Bliss (18)","Strong Power (20)" - }; - - make_cursor_sword(); - - cd_create_dialog_parent_num(996,0); - - - for (i = 0; i < 20; i++) { - cd_add_label(996,i + 4,alch_names[i],1083); - if (party.alchemy[i] > 0) - cd_set_led(996,i + 4,1); - else cd_set_led(996,i + 4,0); - } - - while (dialog_not_toast) - ModalDialog(); - - cd_kill_dialog(996,0); - dialog_not_toast = TRUE; - -} - -void do_xp_keep(short pc_num,short) -{ - for (i = 0; i < 20; i++) - adven[pc_num].skills[i] = store_skills[i]; - adven[pc_num].cur_health += store_h - adven[pc_num].max_health; - adven[pc_num].max_health = store_h; - adven[pc_num].cur_sp += store_sp - adven[pc_num].max_sp; - adven[pc_num].max_sp = store_sp; - -} - -void draw_xp_skills() -{ - short i; - for (i = 0; i < 19; i++) { - if ((store_skp >= skill_cost[i]) && (store_g >= skill_g_cost[i])) - cd_text_frame(1010,54 + i,11); - else cd_text_frame(1010,54 + i,1); - cd_set_item_num(1010,54 + i,store_skills[i]); - } - - if ((store_skp >= 1) && (store_g >= 10)) - cd_text_frame(1010,52,11); - else cd_text_frame(1010,52,1); - cd_set_item_num(1010,52,store_h); - if ((store_skp >= 1) && (store_g >= 15)) - cd_text_frame(1010,53,11); - else cd_text_frame(1010,53,1); - cd_set_item_num(1010,53,store_sp); -} - - -void do_xp_draw() - -{ - - - char get_text[256]; - short pc_num; - - pc_num = store_train_pc; - - sprintf((char *) get_text, "%s",(char *) adven[pc_num].name); - - - cd_set_item_text (1010, 51,get_text); - - for (i = 0; i < 20; i++) - store_skills[i] = adven[pc_num].skills[i]; - store_h = adven[pc_num].max_health; - store_sp = adven[pc_num].max_sp; - store_g = 12000; - store_skp = 10000; - - draw_xp_skills(); - - update_gold_skills(); -} - -Boolean spend_xp_event_filter (short item_hit) -{ - short pc_num; - - Boolean talk_done = FALSE; - - pc_num = store_train_pc; - - switch (item_hit) { - case 73: - dialog_answer = 0; - talk_done = TRUE; - break; - - - - case 3: case 4: - if (((store_h >= 250) && (item_hit == 4)) ||((store_h <= 2) && (item_hit == 3))) - play_sound(0); - else { - if (item_hit == 3) { - store_g += 10; - store_h -= 2; - store_skp += 1; - } - else { - if ((store_g < 10) || (store_skp < 1)) { - - play_sound(0); - } - else { - store_g -= 10; - store_h += 2; - store_skp -= 1; - } - } - - update_gold_skills(); - cd_set_item_num(1010,52,store_h); - draw_xp_skills(); - - } - break; - - case 5: case 6: - if (((store_sp >= 150) && (item_hit == 6)) || ((store_sp <= 0) && (item_hit == 5))) - play_sound(0); - else { - if (item_hit == 5) { - store_g += 15; - store_sp -= 1; - store_skp += 1; - } - else { - if ((store_g < 15) || (store_skp < 1)) { - - play_sound(0); - } - else { - store_sp += 1; - store_g -= 15; - store_skp -= 1; - } - } - - update_gold_skills(); - cd_set_item_num(1010,53,store_sp); - draw_xp_skills(); - } - break; - - case 48: - do_xp_keep(pc_num,0); - dialog_answer = 1; - talk_done = TRUE; - break; - - case 49: - - do_xp_keep(pc_num,0); - do { - pc_num = (pc_num == 0) ? 5 : pc_num - 1; - } while (adven[pc_num].main_status != 1); - store_train_pc = pc_num; - do_xp_draw(); - break; - - case 50: - - do_xp_keep(pc_num,0); - do { - pc_num = (pc_num == 5) ? 0 : pc_num + 1; - } while (adven[pc_num].main_status != 1); - store_train_pc = pc_num; - do_xp_draw(); - break; - - case 100: - break; - - default: - if (item_hit >= 100) { - } - else { - which_skill = (item_hit - 7) / 2; - - if (((store_skills[which_skill] >= skill_max[which_skill]) && ((item_hit - 7) % 2 == 1)) || - ((store_skills[which_skill] == 0) && ((item_hit - 7) % 2 == 0) && (which_skill > 2)) || - ((store_skills[which_skill] == 1) && ((item_hit - 7) % 2 == 0) && (which_skill <= 2))) - play_sound(0); - else { - if ((item_hit - 7) % 2 == 0) { - store_g += skill_g_cost[which_skill]; - store_skills[which_skill] -= 1; - store_skp += skill_cost[which_skill]; - } - else { - if ((store_g < skill_g_cost[which_skill]) || (store_skp < skill_cost[which_skill])) { - - play_sound(0); - } - else { - store_skills[which_skill] += 1; - store_g -= skill_g_cost[which_skill]; - store_skp -= skill_cost[which_skill]; - } - } - - update_gold_skills(); - cd_set_item_num(1010,54 + which_skill,store_skills[which_skill]); - draw_xp_skills(); - } - } - break; - } - - store_train_pc = pc_num; - if (talk_done == TRUE) { - dialog_not_toast = FALSE; - } - return FALSE; -} -void update_gold_skills() -{ - csit(1010,47,"Lots!"); - csit(1010,46,"Lots!"); -} -Boolean spend_xp(short pc_num, short, short parent) -//short mode; // 0 - create 1 - train -// returns 1 if cancelled -{ - char get_text[256],text2[256]; - - - store_train_pc = pc_num; - - make_cursor_sword(); - - cd_create_dialog_parent_num(1010,parent); - sprintf((char *) get_text,"Health (%d/%d)",1,10); - cd_add_label(1010,52,(char *) get_text,1075); - sprintf((char *) get_text,"Spell Pts. (%d/%d)",1,15); - //cd_add_label(1010,5,get_text,1040); - cd_add_label(1010,53,(char *) get_text,1075); - for (i = 54; i < 73; i++) { - get_str(text2,9,1 + 2 * (i - 54)); - sprintf((char *) get_text,"%s (%d/%d)",text2,skill_cost[i - 54],skill_g_cost[i - 54]); - cd_add_label(1010,i,(char *) get_text,(i < 63) ? 1075 : 1069); - } - do_xp_draw(); - - dialog_answer = 0; - - while (dialog_not_toast) - ModalDialog(); - - - cd_kill_dialog(1010,0); - - return dialog_answer; -} - -void edit_xp_event_filter (short) -{ - char get_text[256]; - int tmp; - - cd_get_text_edit_str(1024,(char *) get_text); - sscanf((char *) get_text,"%d",&tmp); - dialog_answer = tmp; - dialog_not_toast = FALSE; -} - -void edit_xp(pc_record_type *pc) -{ - - short item_hit; - char sign_text[256]; - - - store_xp_pc = pc; - - make_cursor_sword(); - - cd_create_dialog(1024,mainPtr); - - sprintf((char *) sign_text,"%d",(short)pc->experience); - cd_set_text_edit_str(1024,(char *) sign_text); - item_hit = get_tnl(store_xp_pc); - cdsin(1024,8,item_hit); - - while (dialog_not_toast) - ModalDialog(); - - cd_kill_dialog(1024,0); - - if (dialog_answer < 0) - dialog_answer = dialog_answer * -1; - dialog_answer = minmax(0,10000,dialog_answer); - - pc->experience = dialog_answer; -} diff --git a/Win32/Blades of Exile Char Editor/EDACTION.H b/Win32/Blades of Exile Char Editor/EDACTION.H deleted file mode 100644 index 88b67f50..00000000 --- a/Win32/Blades of Exile Char Editor/EDACTION.H +++ /dev/null @@ -1,20 +0,0 @@ -Boolean handle_action(POINT the_point, UINT wparam, LONG lparam ); -void flash_rect(RECT to_flash); -void edit_gold_or_food_event_filter (short item_hit); -void edit_gold_or_food(short which_to_edit); -void put_pc_graphics(); -Boolean display_pc_event_filter (short item_hit); -void display_pc(short pc_num,short mode,short parent); -Boolean display_alchemy_event_filter (short item_hit); -void display_alchemy(); -void do_xp_keep(short pc_num,short mode); -void draw_xp_skills(); -void do_xp_draw(); -Boolean spend_xp_event_filter (short item_hit); -void update_gold_skills(); -Boolean spend_xp(short pc_num, short mode, short parent); -void edit_day(); -void edit_day_event_filter (short item_hit); -void edit_xp_event_filter (short item_hit); -void edit_xp(pc_record_type *pc); - diff --git a/Win32/Blades of Exile Char Editor/EDFILEIO.CPP b/Win32/Blades of Exile Char Editor/EDFILEIO.CPP deleted file mode 100644 index 177a638e..00000000 --- a/Win32/Blades of Exile Char Editor/EDFILEIO.CPP +++ /dev/null @@ -1,1334 +0,0 @@ -#include -#include - -#include -#include "stdio.h" - -#include "global.h" -#include "edfileio.h" -#include "graphics.h" -#include "edsound.h" -#include "editors.h" - - -/* Adventure globals */ -extern party_record_type party; -extern pc_record_type adven[6]; -extern outdoor_record_type outdoors[2][2]; -extern current_town_type c_town; -extern big_tr_type t_d; -extern stored_items_list_type t_i; -extern unsigned char misc_i[64][64],sfx[64][64]; -extern unsigned char out[96][96]; -extern unsigned char out_e[96][96]; -extern setup_save_type setup_save; -extern stored_items_list_type stored_items[3]; -extern stored_town_maps_type maps; -extern stored_outdoor_maps_type o_maps; - -extern scen_item_data_type scen_item_list; -extern char file_path_name[256]; -extern short item_menus_lock; - -extern Boolean play_sounds,sys_7_avail,party_in_scen; -extern short current_active_pc; -extern HWND mainPtr; - -extern Boolean file_in_mem; - - -typedef struct { - char expl[96][96]; - } out_info_type; - -extern short store_flags[3]; - -// Big waste! -out_info_type store_map; -char last_load_file[63] = "blades.sav"; -char szFileName [128] = "blades.sav"; -char szTitleName [128] = "blades.sav"; -OPENFILENAME ofn; -extern stored_town_maps_type town_maps; -extern char town_strs[180][256]; - -short store_size; - - -void Get_Path(char* path){ - -char file_path[256]=""; // initialization -GetModuleFileName(NULL,file_path,256); // get path to the executable - -int i=255; // initialize the first while loop -while(file_path[i] != '\\') - { - i--; // find the last '\' in the path to the executable - } // in order to get rid of 'blades of exile.exe' - - -int j=0; // initialize the second loop - -for(j=0;j 0) { - current_active_pc = i; - i = 6; - } - - file_in_mem = TRUE; - party_in_scen = in_scen; - - item_menus_lock = load_items_list(); - - redraw_screen(); -} - -short load_items_list(){ //LOAD SCENARIO ITEMS LIST - - HANDLE scen_file_id; - DWORD dwScenByteRead; - - scenario_data_type scenario; - char scen_name[256]=""; - - if(party_in_scen) - sprintf(scen_name,"scenarios/%s",party.scen_name); - else - sprintf(scen_name,"bladbase.exs"); - - scen_file_id = CreateFile(scen_name, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (scen_file_id == INVALID_HANDLE_VALUE) - { - CloseHandle(scen_file_id); - MessageBox(mainPtr,"Couldn't open the scenario file, trying to use bladbase.exs instead.", - "File Error",MB_OK | MB_ICONEXCLAMATION); - scen_file_id = CreateFile("bladbase.exs", GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if(scen_file_id == INVALID_HANDLE_VALUE){ - CloseHandle(scen_file_id); - MessageBox(mainPtr,"Couldn't open bladbase.exs, can't give items.", - "File Error",MB_OK | MB_ICONEXCLAMATION); - return 1; - } - } - - if (ReadFile(scen_file_id, &scenario, sizeof(scenario_data_type), &dwScenByteRead, NULL) == FALSE) //get scenario data - { - CloseHandle(scen_file_id); - MessageBox(mainPtr,"Invalid scenario file !", - "File Error",MB_OK | MB_ICONEXCLAMATION); - return 1; - } - -// item data - - if (ReadFile(scen_file_id, &scen_item_list, sizeof(scen_item_data_type), &dwScenByteRead, NULL) == FALSE) - { - CloseHandle(scen_file_id); -MessageBox(mainPtr,"Couldn't read the scenario item list !", - "File Error",MB_OK | MB_ICONEXCLAMATION); - return 1; - } - - if ((scenario.flag1 == 10) && (scenario.flag2 == 20) - && (scenario.flag3 == 30) - && (scenario.flag4 == 40)) { - port_item_list(); //Mac scenario, so let's make sure to adjust items properties - } - - CloseHandle(scen_file_id); - - return 0; -}//END SCENARIO ITEMS LIST LOADING - -void load_town_strings(short which_town){ //LOAD TOWNS STRINGS LIST - - HANDLE scen_file_id; - long len, len_to_jump=0; - DWORD dwScenByteRead; - - scenario_data_type scenario; - - char scen_name[256]=""; - int i,j; - - sprintf(scen_name,"scenarios/%s",party.scen_name); - - scen_file_id = CreateFile(scen_name, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (scen_file_id == INVALID_HANDLE_VALUE) - { - MessageBox(mainPtr,"Couldn't open the scenario file !", - "File Error",MB_OK | MB_ICONEXCLAMATION); - return; - } - -if (ReadFile(scen_file_id, &scenario, sizeof(scenario_data_type), &dwScenByteRead, NULL) == FALSE) - { - CloseHandle(scen_file_id); - MessageBox(mainPtr,"Invalid scenario file !", - "File Error",MB_OK | MB_ICONEXCLAMATION); - return; - } - - if ((scenario.flag1 == 10) && (scenario.flag2 == 20) - && (scenario.flag3 == 30) - && (scenario.flag4 == 40)) { - port_scenario(&scenario); //Mac scenario, so let's make sure we can read it properly - } - - len_to_jump += sizeof(scen_item_data_type);//now let's jump to the town_strings position - for (i = 0; i < 300; i++) - len_to_jump += (long) scenario.scen_str_len[i]; - long store = 0; - for (i = 0; i < 100; i++) - for (j = 0; j < 2; j++) - store += (long) (scenario.out_data_size[i][j]); - for (i = 0; i < which_town; i++) - for (j = 0; j < 5; j++) - store += (long) (scenario.town_data_size[i][j]); - len_to_jump += store; - len_to_jump += sizeof(town_record_type); - - SetFilePointer(scen_file_id, len_to_jump, NULL, FILE_CURRENT); - - switch (scenario.town_size[which_town]) { - case 0: - SetFilePointer(scen_file_id, sizeof(big_tr_type), NULL, FILE_CURRENT); - break; - - case 1: - SetFilePointer(scen_file_id, sizeof(ave_tr_type), NULL, FILE_CURRENT); - break; - - case 2: - SetFilePointer(scen_file_id, sizeof(tiny_tr_type), NULL, FILE_CURRENT); - break; - } - - // town strings - - for (i = 0; i < 140; i++) { - len = (long) (c_town.town.strlens[i]); - ReadFile(scen_file_id, &town_strs[i], len, &dwScenByteRead, NULL); - town_strs[i][len] = 0; - } - - CloseHandle(scen_file_id); - -}//END TOWNS STRINGS LOADING - -void save_file(short mode) -//short mode; // 0 - normal 1 - save as -{ - HANDLE file_id; - - short i,j; - - DWORD count, bytes, dwByteRead; - short flag; - short *store; - party_record_type *party_ptr; - setup_save_type *setup_ptr; - pc_record_type *pc_ptr; - - char *party_encryptor; - - Boolean town_save = FALSE,in_scen = FALSE,save_maps = FALSE; - - if (file_in_mem == FALSE) - return; - - if (store_flags[0] == 1342) - town_save = TRUE; - if (store_flags[1] == 100) - in_scen = TRUE; - if (store_flags[2] == 5567) { - save_maps = TRUE; - } - - ofn.hwndOwner = mainPtr; - ofn.lpstrFile = szFileName; - ofn.lpstrFileTitle = szTitleName; - ofn.Flags = OFN_OVERWRITEPROMPT; - - if (mode == 1) { - if (GetSaveFileName(&ofn) == 0) - return; - } - - file_id = CreateFile(szFileName, GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - - SetCurrentDirectory(file_path_name); - - if (file_id == INVALID_HANDLE_VALUE) return; - - store = &flag; - - flag = (town_save == TRUE) ? 1342 : 5790; - if (WriteFile(file_id, store, sizeof(short), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - FCD(1069,0); - return; - } - flag = (in_scen == TRUE) ? 100 : 200; - if (WriteFile(file_id, store, sizeof(short), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - FCD(1069,0); - return; - } - flag = (save_maps == TRUE) ? 5567 : 3422; - if (WriteFile(file_id, store, sizeof(short), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - FCD(1069,0); - return; - } - - // SAVE PARTY - party_ptr = &party; - - party_encryptor = (char *) party_ptr; - for (count = 0; count < sizeof(party_record_type); count++) - party_encryptor[count] ^= 0x5C; - - WriteFile(file_id, &party.age, 4, &dwByteRead, NULL); - WriteFile(file_id, &party.gold, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.food, 2, &dwByteRead, NULL); - WriteFile(file_id, party.stuff_done, 310*10, &dwByteRead, NULL); - WriteFile(file_id, party.item_taken, 200*8, &dwByteRead, NULL); - WriteFile(file_id, &party.light_level, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.outdoor_corner.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.outdoor_corner.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.i_w_c.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.i_w_c.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.p_loc.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.p_loc.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.loc_in_sec.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.loc_in_sec.y, 1, &dwByteRead, NULL); - - for (i = 0; i < 30; i++) - { - WriteFile(file_id, &party.boats[i].boat_loc.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.boats[i].boat_loc.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.boats[i].boat_loc_in_sec.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.boats[i].boat_loc_in_sec.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.boats[i].boat_sector.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.boats[i].boat_sector.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.boats[i].which_town, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.boats[i].exists, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.boats[i].property, 1, &dwByteRead, NULL); - } - for (i = 0; i < 30; i++) - { - WriteFile(file_id, &party.horses[i].horse_loc.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.horses[i].horse_loc.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.horses[i].horse_loc_in_sec.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.horses[i].horse_loc_in_sec.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.horses[i].horse_sector.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.horses[i].horse_sector.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.horses[i].which_town, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.horses[i].exists, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.horses[i].property, 1, &dwByteRead, NULL); - } - for (i = 0; i < 4; i++) - { - for (j = 0; j < 60; j++) - { - WriteFile(file_id, &party.creature_save[i].dudes[j].active, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].attitude, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].number, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_loc.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_loc.y, 1, &dwByteRead, NULL); - { - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.m_num, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.level, 1, &dwByteRead, NULL); - WriteFile(file_id, party.creature_save[i].dudes[j].m_d.m_name, 26, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.health, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.m_health, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.mp, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.max_mp, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.armor, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.skill, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.a, 2*3, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.a1_type, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.a23_type, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.m_type, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.speed, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.ap, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.mu, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.cl, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.breath, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.breath_type, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.treasure, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.spec_skill, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.poison, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.morale, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.m_morale, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.corpse_item, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.corpse_item_chance, 2, &dwByteRead, NULL); - WriteFile(file_id, party.creature_save[i].dudes[j].m_d.status, 2*15, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.direction, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.immunities, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.x_width, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.y_width, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.radiate_1, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.radiate_2, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.default_attitude, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.summon_type, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.default_facial_pic, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.res1, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.res2, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.res3, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].m_d.picture_num, 2, &dwByteRead, NULL); - } - WriteFile(file_id, &party.creature_save[i].dudes[j].mobile, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].summoned, 2, &dwByteRead, NULL); - { - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.number, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.start_attitude, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.start_loc.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.start_loc.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.mobile, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.time_flag, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.extra1, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.extra2, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.spec1, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.spec2, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.spec_enc_code, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.time_code, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.monster_time, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.personality, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.special_on_kill, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.facial_pic, 2, &dwByteRead, NULL); - } - } - - WriteFile(file_id, &party.creature_save[i].which_town, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.creature_save[i].friendly, 2, &dwByteRead, NULL); - } - - WriteFile(file_id, &party.in_boat, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.in_horse, 2, &dwByteRead, NULL); - for (i = 0; i < 10; i++) - { - WriteFile(file_id, &party.out_c[i].exists, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.out_c[i].direction, 2, &dwByteRead, NULL); - { - WriteFile(file_id, party.out_c[i].what_monst.monst, 7, &dwByteRead, NULL); - WriteFile(file_id, party.out_c[i].what_monst.friendly, 3, &dwByteRead, NULL); - WriteFile(file_id, &party.out_c[i].what_monst.spec_on_meet, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.out_c[i].what_monst.spec_on_win, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.out_c[i].what_monst.spec_on_flee, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.out_c[i].what_monst.cant_flee, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.out_c[i].what_monst.end_spec1, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.out_c[i].what_monst.end_spec1, 2, &dwByteRead, NULL); - } - WriteFile(file_id, &party.out_c[i].which_sector.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.out_c[i].which_sector.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.out_c[i].m_loc.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.out_c[i].m_loc.y, 1, &dwByteRead, NULL); - } - for (i = 0; i < 5; i++) - for (j = 0; j < 10; j++) - { - WriteFile(file_id, &party.magic_store_items[i][j].variety, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].item_level, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].awkward, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].bonus, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].protection, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].charges, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].type, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].magic_use_type, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].graphic_num, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].ability, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].ability_strength, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].type_flag, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].is_special, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].a, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].value, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].weight, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].special_class, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].item_loc.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].item_loc.y, 1, &dwByteRead, NULL); - WriteFile(file_id, party.magic_store_items[i][j].full_name, 25, &dwByteRead, NULL); - WriteFile(file_id, party.magic_store_items[i][j].name, 15, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].treas_class, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].item_properties, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].reserved1, 1, &dwByteRead, NULL); - WriteFile(file_id, &party.magic_store_items[i][j].reserved2, 1, &dwByteRead, NULL); - } - WriteFile(file_id, &party.imprisoned_monst, 2*4, &dwByteRead, NULL); - WriteFile(file_id, party.m_seen, 256, &dwByteRead, NULL); - WriteFile(file_id, party.journal_str, 50, &dwByteRead, NULL); - WriteFile(file_id, party.journal_day, 2*50, &dwByteRead, NULL); - WriteFile(file_id, party.special_notes_str, 2*140*2, &dwByteRead, NULL); - for (i = 0; i < 120; i++) - { - WriteFile(file_id, &party.talk_save[i].personality, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.talk_save[i].town_num, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.talk_save[i].str1, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.talk_save[i].str2, 2, &dwByteRead, NULL); - } - WriteFile(file_id, &party.direction, 2, &dwByteRead, NULL); - WriteFile(file_id, &party.at_which_save_slot, 2, &dwByteRead, NULL); - WriteFile(file_id, party.alchemy, 20, &dwByteRead, NULL); - WriteFile(file_id, party.can_find_town, 200, &dwByteRead, NULL); - WriteFile(file_id, party.key_times, 2*100, &dwByteRead, NULL); - WriteFile(file_id, party.party_event_timers, 2*30, &dwByteRead, NULL); - WriteFile(file_id, party.global_or_town, 2*30, &dwByteRead, NULL); - WriteFile(file_id, party.node_to_call, 2*30, &dwByteRead, NULL); - WriteFile(file_id, party.spec_items, 50, &dwByteRead, NULL); - WriteFile(file_id, party.help_received, 120, &dwByteRead, NULL); - WriteFile(file_id, party.m_killed, 2*200, &dwByteRead, NULL); - WriteFile(file_id, &party.total_m_killed, 4, &dwByteRead, NULL); - WriteFile(file_id, &party.total_dam_done, 4, &dwByteRead, NULL); - WriteFile(file_id, &party.total_xp_gained, 4, &dwByteRead, NULL); - WriteFile(file_id, &party.total_dam_taken, 4, &dwByteRead, NULL); - WriteFile(file_id, party.scen_name, 256, &dwByteRead, NULL); - - for (count = 0; count < sizeof(party_record_type); count++) - party_encryptor[count] ^= 0x5C; - - // SAVE SETUP - setup_ptr = &setup_save; - if (WriteFile(file_id, &setup_save, sizeof(setup_save_type), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - FCD(1069,0); - return; - } - - // SAVE PCS - for (i = 0; i < 6; i++) { - pc_ptr = &adven[i]; - - party_encryptor = (char *) pc_ptr; - for (count = 0; count < sizeof(pc_record_type); count++) - party_encryptor[count] ^= 0x6B; - if (WriteFile(file_id, pc_ptr, sizeof(pc_record_type), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - for (count = 0; count < sizeof(pc_record_type); count++) - party_encryptor[count] ^= 0x6B; - FCD(1069,0); - MessageBeep(MB_OK); - return; - } - for (count = 0; count < sizeof(pc_record_type); count++) - party_encryptor[count] ^= 0x6B; - } - - if (party_in_scen == TRUE) { - - // SAVE OUT DATA - if (WriteFile(file_id, out_e, sizeof(out_info_type), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - FCD(1069,0); - return; - } - - if (town_save == TRUE) { - { - WriteFile(file_id, &c_town.town_num, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.difficulty, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.town, sizeof(town_record_type), &dwByteRead, NULL); - WriteFile(file_id, c_town.explored, 64 * 64, &dwByteRead, NULL); - WriteFile(file_id, &c_town.hostile, 1, &dwByteRead, NULL); - { - for (j = 0; j < 60; j++) - { - WriteFile(file_id, &c_town.monst.dudes[j].active, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].attitude, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].number, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_loc.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_loc.y, 1, &dwByteRead, NULL); - { - WriteFile(file_id, &c_town.monst.dudes[j].m_d.m_num, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.level, 1, &dwByteRead, NULL); - WriteFile(file_id, c_town.monst.dudes[j].m_d.m_name, 26, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.health, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.m_health, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.mp, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.max_mp, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.armor, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.skill, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.a, 2*3, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.a1_type, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.a23_type, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.m_type, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.speed, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.ap, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.mu, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.cl, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.breath, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.breath_type, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.treasure, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.spec_skill, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.poison, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.morale, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.m_morale, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.corpse_item, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.corpse_item_chance, 2, &dwByteRead, NULL); - WriteFile(file_id, c_town.monst.dudes[j].m_d.status, 2*15, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.direction, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.immunities, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.x_width, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.y_width, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.radiate_1, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.radiate_2, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.default_attitude, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.summon_type, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.default_facial_pic, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.res1, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.res2, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.res3, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].m_d.picture_num, 2, &dwByteRead, NULL); - } - WriteFile(file_id, &c_town.monst.dudes[j].mobile, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].summoned, 2, &dwByteRead, NULL); - { - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.number, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.start_attitude, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.start_loc.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.start_loc.y, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.mobile, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.time_flag, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.extra1, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.extra2, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.spec1, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.spec2, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.spec_enc_code, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.time_code, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.monster_time, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.personality, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.special_on_kill, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.dudes[j].monst_start.facial_pic, 2, &dwByteRead, NULL); - } - } - WriteFile(file_id, &c_town.monst.which_town, 2, &dwByteRead, NULL); - WriteFile(file_id, &c_town.monst.friendly, 2, &dwByteRead, NULL); - } - - WriteFile(file_id, &c_town.in_boat, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.p_loc.x, 1, &dwByteRead, NULL); - WriteFile(file_id, &c_town.p_loc.y, 1, &dwByteRead, NULL); - } - - if (WriteFile(file_id, &t_d, sizeof(big_tr_type), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - FCD(1069,0); - return; - } - if (WriteFile(file_id, &t_i, sizeof(stored_items_list_type), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - FCD(1069,0); - return; - } - } - - // Save stored items - for (i = 0; i < 3; i++) { - if (WriteFile(file_id, &stored_items[i], sizeof(stored_items_list_type), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - FCD(1069,0); - return; - } - } - - // If saving maps, save maps - if (save_maps == TRUE) { - if (WriteFile(file_id, &(town_maps), sizeof(stored_town_maps_type), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - FCD(1069,0); - return; - } - - if (WriteFile(file_id, &o_maps, sizeof(stored_outdoor_maps_type), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - FCD(1069,0); - return; - } - } - - // SAVE SFX and MISC_I - if (WriteFile(file_id, sfx, (64 * 64), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - return; - } - if (WriteFile(file_id, misc_i, (64 * 64), &bytes, NULL) == FALSE) - { - CloseHandle(file_id); - FCD(1069,0); - return; - } - } - - CloseHandle(file_id); -} - - -void leave_town() -{ - store_flags[0] = 5790; -} - - -void remove_party_from_scen() -{ - store_flags[1] = 200; - party_in_scen = FALSE; -} - -void get_reg_data() -{ - const int BUFFER_LEN = 64; - char buffer[BUFFER_LEN]; - const char * iniFile = "./blades.ini"; - const char * section = "Blades of Exile"; - - GetPrivateProfileString(section, "play_sounds", "1", buffer, BUFFER_LEN, iniFile); - play_sounds = (atoi(buffer))? TRUE : FALSE; -} - -//Mac porting stuff - -void port_scenario(scenario_data_type *scenario) -{ - short i,j; - - flip_short(&scenario->flag_a); - flip_short(&scenario->flag_b); - flip_short(&scenario->flag_c); - flip_short(&scenario->flag_d); - flip_short(&scenario->flag_e); - flip_short(&scenario->flag_f); - flip_short(&scenario->flag_g); - flip_short(&scenario->flag_h); - flip_short(&scenario->flag_i); - flip_short(&scenario->intro_mess_pic); - flip_short(&scenario->intro_mess_len); - flip_short(&scenario->which_town_start); - for (i = 0; i < 200; i++) - for (j = 0; j < 5; j++) - flip_short(&scenario->town_data_size[i][j]); - for (i = 0; i < 10; i++) - flip_short(&scenario->town_to_add_to[i]); - for (i = 0; i < 10; i++) - for (j = 0; j < 2; j++) - flip_short(&scenario->flag_to_add_to_town[i][j]); - for (i = 0; i < 100; i++) - for (j = 0; j < 2; j++) - flip_short(&scenario->out_data_size[i][j]); - for (i = 0; i < 3; i++) - flip_rect(&scenario->store_item_rects[i]); - for (i = 0; i < 3; i++) - flip_short(&scenario->store_item_towns[i]); - for (i = 0; i < 50; i++) - flip_short(&scenario->special_items[i]); - for (i = 0; i < 50; i++) - flip_short(&scenario->special_item_special[i]); - flip_short(&scenario->rating); - flip_short(&scenario->uses_custom_graphics); - for (i = 0; i < 256; i++) { - flip_short(&scenario->scen_monsters[i].health); - flip_short(&scenario->scen_monsters[i].m_health); - flip_short(&scenario->scen_monsters[i].max_mp); - flip_short(&scenario->scen_monsters[i].mp); - flip_short(&scenario->scen_monsters[i].a[1]); - flip_short(&scenario->scen_monsters[i].a[0]); - flip_short(&scenario->scen_monsters[i].a[2]); - flip_short(&scenario->scen_monsters[i].morale); - flip_short(&scenario->scen_monsters[i].m_morale); - flip_short(&scenario->scen_monsters[i].corpse_item); - flip_short(&scenario->scen_monsters[i].corpse_item_chance); - flip_short(&scenario->scen_monsters[i].picture_num); - } - - for (i = 0; i < 256; i++) { - flip_short(&scenario->ter_types[i].picture); - } - for (i = 0; i < 30; i++) { - flip_short(&scenario->scen_boats[i].which_town); - } - for (i = 0; i < 30; i++) { - flip_short(&scenario->scen_horses[i].which_town); - } - for (i = 0; i < 20; i++) - flip_short(&scenario->scenario_timer_times[i]); - for (i = 0; i < 20; i++) - flip_short(&scenario->scenario_timer_specs[i]); - for (i = 0; i < 256; i++) { - flip_spec_node(&scenario->scen_specials[i]); - } - for (i = 0; i < 10; i++) { - flip_short(&scenario->storage_shortcuts[i].ter_type); - flip_short(&scenario->storage_shortcuts[i].property); - for (j = 0; j < 10; j++) { - flip_short(&scenario->storage_shortcuts[i].item_num[j]); - flip_short(&scenario->storage_shortcuts[i].item_odds[j]); - } - } - flip_short(&scenario->last_town_edited); -} - -void flip_short(short *s) -{ - char store,*s1, *s2; - - s1 = (char *) s; - s2 = s1 + 1; - store = *s1; - *s1 = *s2; - *s2 = store; -} - -void flip_rect(RECT16 *s) -{ - short a; - flip_short((short *) &(s->top)); - flip_short((short *) &(s->bottom)); - flip_short((short *) &(s->left)); - flip_short((short *) &(s->right)); - a = s->top; - s->top = s->left; - s->left = a; - a = s->bottom; - s->bottom = s->right; - s->right = a; -} - -void flip_spec_node(special_node_type *spec) -{ - flip_short(&(spec->type)); - flip_short(&(spec->sd1)); - flip_short(&(spec->sd2)); - flip_short(&(spec->pic)); - flip_short(&(spec->m1)); - flip_short(&(spec->m2)); - flip_short(&(spec->ex1a)); - flip_short(&(spec->ex1b)); - flip_short(&(spec->ex2a)); - flip_short(&(spec->ex2b)); - flip_short(&(spec->jumpto)); -} - -void port_item_list() -{ - short i; - - for (i = 0; i < 400; i++) { - flip_short(&(scen_item_list.scen_items[i].variety)); - flip_short(&(scen_item_list.scen_items[i].item_level)); - flip_short(&(scen_item_list.scen_items[i].value)); - } -} diff --git a/Win32/Blades of Exile Char Editor/EDFILEIO.H b/Win32/Blades of Exile Char Editor/EDFILEIO.H deleted file mode 100644 index e32f4534..00000000 --- a/Win32/Blades of Exile Char Editor/EDFILEIO.H +++ /dev/null @@ -1,14 +0,0 @@ -void file_initialize(); -void save_file(short mode); -void load_file(); -void leave_town(); -void get_reg_data(); -void remove_party_from_scen(); -void Get_Path(char* path); -short load_items_list(); -void load_town_strings(short which_town); -void port_scenario(scenario_data_type *scenario); -void port_item_list(); -void flip_short(short *s); -void flip_rect(RECT16 *s); -void flip_spec_node(special_node_type *spec); diff --git a/Win32/Blades of Exile Char Editor/EDITORS.CPP b/Win32/Blades of Exile Char Editor/EDITORS.CPP deleted file mode 100644 index e8bf13f6..00000000 --- a/Win32/Blades of Exile Char Editor/EDITORS.CPP +++ /dev/null @@ -1,406 +0,0 @@ -#include - - -#include "graphics.h" -#include "global.h" -#include "editors.h" -#include "dlogtool.h" - -/* Adventure globals */ -extern party_record_type party; -extern pc_record_type adven[6]; -extern outdoor_record_type outdoors[2][2]; -extern current_town_type c_town; -extern big_tr_type t_d; -extern stored_items_list_type t_i; -extern unsigned char out[96][96]; -extern unsigned char out_e[96][96]; -extern setup_save_type setup_save; -extern stored_items_list_type stored_items[3]; -extern stored_town_maps_type maps; -extern stored_outdoor_maps_type o_maps; -extern short dialog_answer; - -extern short store_flags[3]; -extern Boolean dialog_not_toast; - -extern short current_active_pc; - -extern HWND mainPtr; -extern short current_cursor; - -extern HCURSOR sword_curs; -extern Boolean diff_depth_ok,current_file_has_maps; - -Boolean equippable[18] = {FALSE,TRUE,TRUE,FALSE,TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,TRUE,TRUE, - TRUE,TRUE,TRUE,FALSE,FALSE,TRUE}; -short num_hands_to_use[18] = {0,1,2,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0}; -short num_that_can_equip[18] = {0,2,1,0,1,1,1,0,0,2,1,1,1,2,1,0,0,1}; -short selected,item_max = 0; -Boolean choice_active[6]; - - - -extern short store_trait_mode; -pc_record_type *store_pc; -HBITMAP button_num_gworld; - -FARPROC dlog_proc1; -HWND test_dlog3; -short answer_given; -HWND store_focus; -extern HANDLE store_hInstance; - -void combine_things(short pc_num) -{ - - short i,j,test; - - for (i = 0; i < 24; i++) { - if ((adven[pc_num].items[i].variety > 0) && - (adven[pc_num].items[i].type_flag > 0) && (adven[pc_num].items[i].item_properties & 254 != 0)) { - for (j = i + 1; j < 24; j++) - if ((adven[pc_num].items[j].variety > 0) && - (adven[pc_num].items[j].type_flag == adven[pc_num].items[i].type_flag) - && (adven[pc_num].items[j].item_properties & 254 != 0)) { - test = (short) (adven[pc_num].items[i].charges) + (short) (adven[pc_num].items[j].charges); - if (test > 125) { - adven[pc_num].items[i].charges = 125; - } - else adven[pc_num].items[i].charges += adven[pc_num].items[j].charges; - if (adven[pc_num].equip[j] == TRUE) { - adven[pc_num].equip[i] = TRUE; - adven[pc_num].equip[j] = FALSE; - } - take_item(pc_num,j); - } - } - if ((adven[pc_num].items[i].variety > 0) && (adven[pc_num].items[i].charges < 0)) - adven[pc_num].items[i].charges = 1; - } -} - -Boolean give_to_pc(short pc_num,item_record_type item, short) -{ - short free_space; - - - if (item.variety == 0) - return TRUE; - if (((free_space = pc_has_space(pc_num)) == 24 ) || (adven[pc_num].main_status != 1)) - return FALSE; - else { - adven[pc_num].items[free_space] = item; - combine_things(pc_num); - return TRUE; - } - return FALSE; -} - -Boolean give_to_party(item_record_type item,short print_result) -{ - short i = 0; - - while (i < 6) { - if (give_to_pc(i,item,print_result) == TRUE) - return TRUE; - i++; - } - return FALSE; -} - -void give_gold(short amount, Boolean) -{ - party.gold += amount; -} - -Boolean take_gold(short amount,Boolean) -{ - if (party.gold < amount) - return FALSE; - party.gold -= amount; - return TRUE; -} - - -short pc_has_space(short pc_num) -{ - short i = 0; - - while (i < 24) { - if (adven[pc_num].items[i].variety == 0) - return i; - i++; - } - return 24; -} - - -void take_item(short pc_num,short which_item) -//short pc_num,which_item; // if which_item > 20, don't update stat win, item is which_item - 20 -{ - short i; - - - if ((adven[pc_num].weap_poisoned == which_item) && (adven[pc_num].status[0] > 0)) { -// add_string_to_buf(" Poison lost. "); - adven[pc_num].status[0] = 0; - } - if ((adven[pc_num].weap_poisoned > which_item) && (adven[pc_num].status[0] > 0)) - adven[pc_num].weap_poisoned--; - - for (i = which_item; i < 23; i++) { - adven[pc_num].items[i] = adven[pc_num].items[i + 1]; - adven[pc_num].equip[i] = adven[pc_num].equip[i + 1]; - } - adven[pc_num].items[23].variety = 0; - adven[pc_num].equip[23] = FALSE; - -} - - -void fancy_choice_dialog_event_filter (short item_hit) -{ - dialog_not_toast = FALSE; - dialog_answer = item_hit; -} - -short fancy_choice_dialog(short which_dlog,short parent) -// ignore parent in Mac version -{ - short i,store_dialog_answer; - - - store_dialog_answer = dialog_answer; - make_cursor_sword(); - - cd_create_dialog_parent_num(which_dlog,parent); - - - while (dialog_not_toast) - ModalDialog(); - - cd_kill_dialog(which_dlog,0); - - i = dialog_answer; - dialog_answer = store_dialog_answer; - - return i; -} - -void select_pc_event_filter (short item_hit) -{ - dialog_not_toast = FALSE; - if (item_hit == 16) - dialog_answer = 6; - else dialog_answer = item_hit - 3; -} - -short char_select_pc(short active_only,short free_inv_only,char *title) -//active_only; // 0 - no 1 - yes 2 - disarm trap -{ - short i; - - make_cursor_sword(); - - cd_create_dialog(1018,mainPtr); - - if (active_only == 2) - csit(1018,15,"Select PC to disarm trap:"); - else csit( 1018,15,title); - - for (i = 0; i < 6; i++) { - if ((adven[i].main_status == 0) || - ((active_only == TRUE) && (adven[i].main_status > 1)) || - ((free_inv_only == 1) && (pc_has_space(i) == 24)) || (adven[i].main_status == 5)) { - cd_activate_item(1018, 3 + i, 0); - } - if (adven[i].main_status != 0) { - csit(1018,9 + i,adven[i].name); - } - else cd_activate_item(1018, 9 + i, 0); - } - - while (dialog_not_toast) - ModalDialog(); - - cd_kill_dialog(1018,0); - - return dialog_answer; -} - -short select_pc(short active_only,short free_inv_only) -//active_only; // 0 - no 1 - yes 2 - disarm trap -{ - if (active_only == 2) - return char_select_pc(active_only,free_inv_only,"Trap! Who will disarm?"); - else return char_select_pc(active_only,free_inv_only,"Select a character:"); -} - - -BOOL CALLBACK choice_dialog_proc - (HWND hDlg, UINT message, WPARAM wParam, LPARAM) { - - - - - - - test_dlog3 = hDlg; - - switch (message) { - case WM_INITDIALOG: - center_window(hDlg); - - return TRUE; - case WM_PAINT: - - return FALSE; - - case WM_COMMAND: - answer_given = (short) LOWORD(wParam); - if (answer_given == 100) - answer_given = 2; - EndDialog(hDlg, 0); - return TRUE; - } - return FALSE; - } - -short choice_dialog(short,short num) -{ - - - store_focus = GetFocus(); - dlog_proc1 = (FARPROC) choice_dialog_proc; - if (dlog_proc1 == NULL) { - return 1; - } - DialogBox((HINSTANCE) store_hInstance, MAKEINTRESOURCE(num), store_focus, (DLGPROC) dlog_proc1); - - DestroyWindow(test_dlog3); - SetFocus(store_focus); - return answer_given; -} - - - -short party_total_level() -{ - short i,j = 0; - - for (i = 0; i < 6; i++) - if (adven[i].main_status == 1) - j += adven[i].level; - return j; -} - - - -short luck_total() -{ - short i = 0; - - for (i = 0; i < 6; i++) - if (adven[i].main_status == 1) - i += adven[i].skills[18]; - return i; -} - -void display_traits_graphics() -{ - short i,store; - - for (i = 0; i < 3; i++) { - cd_set_led(1013,4 + i,(store_pc->race == i) ? 1 : 0); - } - for (i = 0; i < 10; i++) { - cd_set_led(1013,7 + i,(store_pc->traits[i] > 0) ? 1 : 0); - } - for (i = 0; i < 5; i++) { - cd_set_led(1013,36 + i,(store_pc->traits[10 + i] > 0) ? 1 : 0); - } - - store = get_tnl(store_pc); - cdsin(1013,18,store); -} - -void pick_race_abil_event_filter(short item_hit) -{ - char abil_str[256]; - pc_record_type *pc; - - pc = store_pc; - switch (item_hit) { - case 3: - dialog_not_toast = FALSE; - break; - case 4: case 5: case 6: - if (store_trait_mode == 0) - pc->race = item_hit - 4; - display_traits_graphics(); - get_str(abil_str,5,12 + item_hit); - csit(1013,19,(char *) abil_str); - break; - case 36: case 37: case 38: case 39: case 40: - if (store_trait_mode != 1) - pc->traits[item_hit - 36 + 10] = (pc->traits[item_hit - 36 + 10] == TRUE) ? FALSE : TRUE; - display_traits_graphics(); - get_str(abil_str,5,item_hit - 36 + 11); - csit(1013,19,(char *) abil_str); - break; - default: - if (item_hit >= 100) - return; - if (store_trait_mode != 1) - pc->traits[item_hit - 7] = (pc->traits[item_hit - 7] == TRUE) ? FALSE : TRUE; - display_traits_graphics(); - get_str(abil_str,5,item_hit - 6); - csit(1013,19,(char *) abil_str); - break; - } - -} - -void pick_race_abil(pc_record_type *pc,short mode,short parent_num) -//mode; // 0 - edit 1 - just display 2 - can't change race -{ - char *start_str1 = "Click on advantage button for description."; - char *start_str2 = "Click on advantage button to add/lose."; - - - mode = 0; - store_trait_mode = mode; - store_pc = pc; - make_cursor_sword(); - - cd_create_dialog_parent_num(1013,parent_num); - - display_traits_graphics(); - if (mode == 1) - csit(1013,19,start_str1); - else csit(1013,19,start_str2); - - while (dialog_not_toast) - ModalDialog(); - - cd_kill_dialog(1013,0); - dialog_not_toast = TRUE; -} - - -short get_tnl(pc_record_type *pc) -{ - short tnl = 100,i,store_per = 100; - short rp[3] = {0,12,20}; - short ap[15] = {10,20,8,10,4, 6,10,7,12,15, -10,-8,-8,-20,-8}; - - tnl = (tnl * (100 + rp[pc->race])) / 100; - for (i = 0; i < 15; i++) - if (pc->traits[i] == TRUE) - store_per = store_per + ap[i]; - - tnl = (tnl * store_per) / 100; - - return tnl; -} diff --git a/Win32/Blades of Exile Char Editor/EDITORS.H b/Win32/Blades of Exile Char Editor/EDITORS.H deleted file mode 100644 index 8561e4d7..00000000 --- a/Win32/Blades of Exile Char Editor/EDITORS.H +++ /dev/null @@ -1,22 +0,0 @@ -Boolean give_to_pc(short pc_num,item_record_type item, short print_result); -Boolean give_to_party(item_record_type item,short print_result); -void give_gold(short amount,Boolean print_result); -Boolean take_gold(short amount,Boolean print_result); -short pc_has_space(short pc_num); -void take_item(short pc_num,short which_item); -void fancy_choice_dialog_event_filter (short item_hit); -short fancy_choice_dialog(short which_dlog,short parent); -void select_pc_event_filter (short item_hit); -short char_select_pc(short active_only,short free_inv_only,char *title); -short select_pc(short active_only,short free_inv_only); -short choice_dialog(short pic,short num); -Boolean give_spec_items_event_filter (short item_hit); -void give_spec_items(); -short party_total_level(); -short luck_total(); -void display_traits_graphics(); -void pick_race_abil_event_filter(short item_hit); -void pick_race_abil(pc_record_type *pc,short mode,short parent_num); -short get_tnl(pc_record_type *pc); -void reset_boats(); -void combine_things(short pc_num); diff --git a/Win32/Blades of Exile Char Editor/EDSOUND.CPP b/Win32/Blades of Exile Char Editor/EDSOUND.CPP deleted file mode 100644 index 38805622..00000000 --- a/Win32/Blades of Exile Char Editor/EDSOUND.CPP +++ /dev/null @@ -1,313 +0,0 @@ -#include "math.h" -#include -#include - -#include "stdio.h" - -#include "global.h" -#include "edsound.h" - -#define NUM_SOUNDS 100 - -HGLOBAL sound_handles[NUM_SOUNDS]; -char * snds[NUM_SOUNDS]; - -extern HINSTANCE store_hInstance; - -extern Boolean play_sounds,in_startup_mode; -extern HWND mainPtr; -extern Boolean gInBackground; -extern party_record_type party; -extern Boolean cat,cow,chicken,dog,sheep,monsters_going; -extern short num_chirps_played,overall_mode; - -short last_played = 10000; -short error_beeps = 0; -short store_last_sound_played = 0; - -Boolean always_asynch[100] = {FALSE,FALSE,FALSE,FALSE,FALSE, - TRUE,TRUE,FALSE,FALSE,FALSE, - TRUE,FALSE,FALSE,FALSE,FALSE, // 10 - FALSE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,TRUE,FALSE,TRUE, // 20 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,TRUE, // 30 - FALSE,FALSE,TRUE,FALSE,TRUE, - FALSE,TRUE,TRUE,TRUE,TRUE, // 40 - TRUE,TRUE,TRUE,TRUE,TRUE, - TRUE,FALSE,FALSE,TRUE,FALSE, // 50 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,TRUE,FALSE,FALSE,FALSE, // 60 - FALSE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,FALSE, // 70 - FALSE,TRUE,TRUE,TRUE,TRUE, - TRUE,TRUE,TRUE,TRUE,FALSE, // 80 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,TRUE,FALSE,FALSE,FALSE, // 90 - FALSE,FALSE,FALSE,FALSE,FALSE}; -Boolean load_when_play[100] = { -0,0,1,1,1,0,0,1,1,1, -0,0,0,1,0,1,1,1,1,1, -1,1,0,1,1,1,1,0,1,1, -1,1,1,1,0,1,1,0,1,1, -1,1,1,1,1,1,1,0,0,0, -0,1,1,0,1,0,1,1,1,1, // 50 -1,0,1,1,1,1,1,1,1,0, -0,0,0,0,0,0,0,0,0,0, // 70 -1,1,1,1,1,0,0,0,0,0, -1,0,1,1,1,1,1,1,1,0 -}; - -short can_ignore[100] = { -0,0,0,0,0,5,3,0,0,0, -5,5,5,0,5,0,0,0,0,0, -0,0,5,0,0,0,0,0,0,2, -2,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,1,1, -1,0,0,5,0,1,0,0,0,0, // 50 -0,0,0,0,5,0,0,0,0,0, -0,0,0,0,0, 0,5,5,5,5, // 70 -4,4,4,4,0,0,0,0,0,0, -0,5,5,0,0,0,0,0,0,0}; -// 1 - polite asych, 1 or 2 or 3- lose easily when pref is set for fewer snds -// 3 can be async -// 4 - nostop asynch ... when 4, this sound is NOSTOP, i.e. when played, is played -// asynch, and refuses all other sounds. Sounds that come in are ignored, and -// disappear into the ether -// 5 - finally, bold asynch ... when 5, this sound is NOSTOP, i.e. when played, is played -// asynch, and refuses all other sounds. When a sound is played on top of this, game -// hangs on until sound is done, and then and only then plays later sound. - - -short num_devs; -Boolean sounds_fucked = FALSE; -long intro_music_start_time = -1; - -void load_sounds () -{ - short i,t,err; - HRSRC h; - char snd_name[20]; - WAVEOUTCAPS wavecaps; - - t = waveOutGetNumDevs(); - if (t == 0) { - sounds_fucked = TRUE; - return; - } - err = waveOutGetDevCaps(0,&wavecaps,sizeof(WAVEOUTCAPS)); -if (err != 0) { - sounds_fucked = TRUE; - switch (err) { - case MMSYSERR_BADDEVICEID: - MessageBox(mainPtr,"Cannot initialize sounds - No sound device detected. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - case MMSYSERR_NODRIVER: - MessageBox(mainPtr,"Cannot initialize sounds - No driver installed. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - case MMSYSERR_NOMEM : - MessageBox(mainPtr,"Cannot initialize sounds - can't find enough memory. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - case MMSYSERR_ALLOCATED: - MessageBox(mainPtr,"Cannot initialize sounds - sound card already allocated. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - case MMSYSERR_ERROR: - MessageBox(mainPtr,"Cannot initialize sounds - internal error. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - default: - MessageBox(mainPtr,"Cannot initialize sounds - unidentified error. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - - } - - } - - for (i = 0; i < NUM_SOUNDS; i++) { - sound_handles[i] = NULL; - load_when_play[i] = TRUE; - if (load_when_play[i] == FALSE) { - sprintf((char *)snd_name,"#%d",i + 1); - h = FindResource(store_hInstance,snd_name,"#100"); - - sound_handles[i] = LoadResource(store_hInstance,h); - snds[i] = (char*) LockResource(sound_handles[i]); - } - } - -} - -void play_sound(short which) // if < 0, play asynch -{ - if (PSD[304][9] > 0) - return; - if (in_startup_mode == TRUE) { - // put some in foreground check here - } - if (play_sounds == TRUE) - force_play_sound(which); -} - - -void force_play_sound(short which) -{ - short i,num_fails = 0; - char snd_name[30]; - Boolean asyn = FALSE,a_sound_did_get_played = FALSE; - Boolean check_sound; - HRSRC h; - - if ((sounds_fucked == TRUE) || (play_sounds == FALSE)) - return; - if (which < 0) { - asyn = TRUE; - which = which * -1; - } - - if (which >= 100) - return; - - if ((always_asynch[which] == TRUE) && - ((can_ignore[which] == 1) || (can_ignore[which] >= 3))) - asyn = TRUE; - if ((can_ignore[which] > 0) && (can_ignore[which] < 5) && (party.stuff_done[305][5] == 1)) - return; - if ((can_ignore[which] != 1) && (can_ignore[which] < 3)) - asyn = FALSE; - if ((party.stuff_done[305][5] == 1) && (can_ignore[which] < 5)) - asyn = FALSE; - - if ((load_when_play[which] == TRUE) && (sound_handles[which] == NULL)) { - asyn = FALSE; - sprintf((char *)snd_name,"#%d",which + 1); - h = FindResource(store_hInstance,snd_name,"#100"); - - sound_handles[which] = LoadResource(store_hInstance,h); - snds[which] = (char*) LockResource(sound_handles[which]); - - } - - if (store_last_sound_played == 6) { - sndPlaySound(NULL,0); - } - - if (asyn == TRUE) { - if (can_ignore[which] >= 4) - check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY | SND_NOSTOP); - else check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY); - - while (check_sound == FALSE) { - - if (can_ignore[store_last_sound_played] == 4) {// then sound goes away - return; - } - - - num_fails++; - if (num_fails < 40) - sound_pause(25); - else { - MessageBox(mainPtr,"Cannot play sounds - Sounds stuck error a. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - //print_nums(111,which,num_fails); - //sounds_fucked = TRUE; - return; - } - //ASB ("Asynch clearing buffer!!!"); - //check_sound = sndPlaySound(snds[99],SND_SYNC | SND_MEMORY); - sndPlaySound(NULL,0); - - if (can_ignore[which] >= 4) - check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY | SND_NOSTOP); - else check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY); - } - a_sound_did_get_played = TRUE; - } - else { - if (can_ignore[which] >= 4) - check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY | SND_NOSTOP); - else check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY); - while (check_sound == FALSE) { - if (can_ignore[store_last_sound_played] == 4) {// then sound goes away - //ASB("Sound overruled by asynch sound."); - return; - } - - - num_fails++; - if (num_fails < 40) - sound_pause(25); - else { - MessageBox(mainPtr,"Cannot play sounds - Sounds stuck error b. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - //print_nums(222,which,num_fails); - //sounds_fucked = TRUE; - return; - } - //ASB ("Asynch clearing buffer!!!"); - //check_sound = sndPlaySound(snds[99],SND_SYNC | SND_MEMORY); - sndPlaySound(NULL,0); - - if (can_ignore[which] >= 4) - check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY | SND_NOSTOP); - else check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY); - } - a_sound_did_get_played = TRUE; - } - - store_last_sound_played = which; - - if ((load_when_play[which] == TRUE) && (asyn == FALSE)) { - // deleted a seemingly extraneous LoadResource here - - - sound_handles[which] = NULL; - } - for (i = 0; i < NUM_SOUNDS; i++) - if ((load_when_play[which] == TRUE) && (sound_handles[which] != NULL) - && (a_sound_did_get_played == TRUE) && (i != which)){ - // deleted a seemingly extraneous LoadResource here - - - sound_handles[i] = NULL; - } - -} - -void kill_sound() -{ - sndPlaySound(NULL,0); -} -void one_sound(short which) -{ - if (which == last_played) - return; - play_sound(which); - last_played = which; -} - -void clear_sound_memory() -{ - last_played = 100; -} - -void flip_sound() -{ - play_sounds = (play_sounds == TRUE) ? FALSE : TRUE; -} - - -void sound_pause(long len) { - long t1,t2; - - t1 = (long) GetCurrentTime(); - t2 = t1; - while (t2 - t1 < len) { - t2 = (long)GetCurrentTime(); - } -} diff --git a/Win32/Blades of Exile Char Editor/EDSOUND.H b/Win32/Blades of Exile Char Editor/EDSOUND.H deleted file mode 100644 index 3629f07e..00000000 --- a/Win32/Blades of Exile Char Editor/EDSOUND.H +++ /dev/null @@ -1,7 +0,0 @@ -void load_sounds (); -void play_sound(short which) ; // if < 0, play asynch -void force_play_sound(short which); -void one_sound(short which); -void clear_sound_memory(); -void sound_pause(long len); -void flip_sound(); diff --git a/Win32/Blades of Exile Char Editor/GLOBAL.CPP b/Win32/Blades of Exile Char Editor/GLOBAL.CPP deleted file mode 100644 index 2a057499..00000000 --- a/Win32/Blades of Exile Char Editor/GLOBAL.CPP +++ /dev/null @@ -1,151 +0,0 @@ -#include -#include "global.h" -#include "math.h" -#include - -extern short give_delays; - -RECT RECT16::rect32() -{ - RECT tmp; - tmp.left = left; - tmp.top = top; - tmp.right = right; - tmp.bottom = bottom; - return tmp; -} - -RECT16::RECT16 (const RECT & tmp) -{ - left = tmp.left; - top = tmp.top; - right = tmp.right; - bottom = tmp.bottom; -} - -RECT16 & RECT16::operator=(const RECT & tmp) -{ - left = tmp.left; - top = tmp.top; - right = tmp.right; - bottom = tmp.bottom; - return (*this); -} - -POINT MAKEPOINT(LONG lParam) -{ - POINT point; - - point.x = LOWORD(lParam); - point.y = HIWORD(lParam); - - return point; -} - -short get_ran (short times,short min,short max) -{ - short store; - short i, to_ret = 0; - - if ((max - min + 1) == 0) - return 0; - for (i = 1; i < times + 1; i++) { - store = rand() % (max - min + 1); - to_ret = to_ret + min + store; - } - return to_ret; -} - -Boolean same_point(location p1,location p2) -{ - if ((p1.x == p2.x) & (p1.y == p2.y)) - return TRUE; - else return FALSE; -} - -short move_to_zero(short val) -{ - if (val < 0) - return val + 1; - if (val > 0) - return val - 1; - return val; -} - -/* -short max(short a,short b) -{ - if (a > b) - return a; - else return b; -} - -short min(short a,short b) -{ - if (a < b) - return a; - else return b; -}*/ - -short minmax(short min,short max,short k) -{ - if (k < min) - return min; - if (k > max) - return max; - return k; -} - -short s_pow(short x,short y) -{ - return (short) pow((double) x, (double) y); -} - -short a_v(short x) -{ - if (x < 0) - return (-1 * x); - else return x; -} -short ex_abs(short x) -{ - if (x < 0) - return (-1 * x); - else return x; -} - -void Delay(short val,long *) -{ - long then,now,wait_val; - - wait_val = (long) val; - wait_val = wait_val * 16; - then = (long)GetCurrentTime(); - now = then; - while (now - then < wait_val) { - now = (long) GetCurrentTime(); - } -} - -void pause(short length) -{ - long dummy,len; - - len = (long) length; - - if (give_delays == 0) - Delay(len, &dummy); -} - -void beep() -{ - long dummy; - - MessageBeep(MB_OK); - Delay(30,&dummy); - } - -void SysBeep(short) -{ - MessageBeep(MB_OK); -} diff --git a/Win32/Blades of Exile Char Editor/GLOBAL.H b/Win32/Blades of Exile Char Editor/GLOBAL.H deleted file mode 100644 index 6ddaf17a..00000000 --- a/Win32/Blades of Exile Char Editor/GLOBAL.H +++ /dev/null @@ -1,441 +0,0 @@ - -#define T_M 60 - -#define NUM_TOWN_ITEMS 115 - -#define SLEEP_TICKS 0L -#define MOUSE_REGION 0L -#define DRAG_EDGE 15 - -#define DISPLAY_LEFT 23 -#define DISPLAY_TOP 23 -#define BITMAP_WIDTH 28 -#define BITMAP_HEIGHT 36 - -#define STORED_GRAPHICS 240 - -#define PC_WIN_UL_X 291 -#define PC_WIN_UL_Y 5 -#define ITEM_WIN_UL_X 291 -#define ITEM_WIN_UL_Y 130 -#define TEXT_WIN_UL_X 291 -#define TEXT_WIN_UL_Y 283 -#define NUM_BUTTONS 15 -#define PSD party.stuff_done -#define DES display_enc_string -#define FCD fancy_choice_dialog -#define D2ES display_2_enc_string -#define NUM_MONST_G 173 - -#define DOOR_LIGHT can_enter = run_trap(7,&PSD[c_town.town_num][which],4220,0); break; -#define DOOR_HEAVY can_enter = run_trap(7,&PSD[c_town.town_num][which],4220,20); break; -#define DOOR_ALARM can_enter = run_trap(7,&PSD[c_town.town_num][which],4220,11); break; -#define DRESSER_LIGHT can_enter = run_trap(7,&PSD[c_town.town_num][which],4221,0); break; -#define DRESSER_HEAVY can_enter = run_trap(7,&PSD[c_town.town_num][which],4221,20); break; -#define DRESSER_ALARM can_enter = run_trap(7,&PSD[c_town.town_num][which],4221,11); break; -#define FLOOR_LIGHT can_enter = run_trap(7,&PSD[c_town.town_num][which],4222,0); break; -#define FLOOR_HEAVY can_enter = run_trap(7,&PSD[c_town.town_num][which],4222,20); break; -#define FLOOR_ALARM can_enter = run_trap(7,&PSD[c_town.town_num][which],4222,11); break; -#define CHEST_LIGHT can_enter = run_trap(7,&PSD[c_town.town_num][which],3450,0); break; -#define CHEST_HEAVY can_enter = run_trap(7,&PSD[c_town.town_num][which],3450,20); break; -#define CHEST_ALARM can_enter = run_trap(7,&PSD[c_town.town_num][which],3450,11); break; - -#define CDGT cd_retrieve_text_edit_str -#define CDGN cd_retrieve_text_edit_num -#define CDST cd_set_text_edit_str -#define CDSN cd_set_text_edit_num - -#define huge - -struct RECT16 -{ - short left; - short top; - short right; - short bottom; - - RECT rect32(); - RECT16 () {} - RECT16 (const RECT & ); - RECT16 & operator=(const RECT &); -}; - -extern POINT MAKEPOINT(LONG lparam); - -typedef unsigned char BYTE; -typedef char Boolean; - -typedef struct { - char x,y; - } location; -typedef struct { - short x,y;} shortloc; - -typedef struct { - short type,sd1,sd2,pic,m1,m2,ex1a,ex1b,ex2a,ex2b,jumpto; - } special_node_type; - -typedef struct { - short personality,type; - char link1[4],link2[4]; - short extras[4]; - } talking_node_type; - -typedef struct { - unsigned char strlens[200]; - talking_node_type talk_nodes[60]; - } talking_record_type; - -typedef struct { - short picture; - unsigned char blockage,flag1,flag2,special,trans_to_what,fly_over,boat_over; - unsigned char block_horse,light_radius,step_sound,shortcut_key,res1,res2,res3; - } terrain_type_type; - -typedef struct { - unsigned char monst[4]; - } wandering_type; - -typedef struct { - unsigned char monst[7]; - unsigned char friendly[3]; - short spec_on_meet,spec_on_win,spec_on_flee,cant_flee; - short end_spec1,end_spec2; -} out_wandering_type; - -typedef struct { - unsigned char terrain[48][48]; - location special_locs[18]; - unsigned char special_id[18]; - location exit_locs[8]; - char exit_dests[8]; - location sign_locs[8]; - out_wandering_type wandering[4],special_enc[4]; - location wandering_locs[4]; - RECT16 info_rect[8]; - unsigned char strlens[180]; - special_node_type specials[60]; - } outdoor_record_type; - -typedef struct { - unsigned char number; - unsigned char start_attitude; - location start_loc; - unsigned char mobile; - unsigned char time_flag; - unsigned char extra1,extra2; - short spec1, spec2; - char spec_enc_code,time_code; - short monster_time,personality; - short special_on_kill,facial_pic; - - } creature_start_type; - - -typedef struct { - short variety, item_level; - char awkward, bonus, protection, charges, type, magic_use_type; - unsigned char graphic_num,ability, ability_strength,type_flag, is_special,a; - short value; - unsigned char weight, special_class; - location item_loc; - char full_name[25], name[15]; - unsigned char treas_class,item_properties,reserved1,reserved2; -} item_record_type; - -typedef struct { - location item_loc; - short item_code,ability; - unsigned char charges,always_there,property,contained; - } preset_item_type; - -typedef struct { - location field_loc; - short field_type; - } preset_field_type; - -typedef struct { - short town_chop_time,town_chop_key; - wandering_type wandering[4]; - location wandering_locs[4]; - location special_locs[50]; - unsigned char spec_id[50]; - location sign_locs[15]; - short lighting; - location start_locs[4]; - location exit_locs[4]; - short exit_specs[4]; - RECT16 in_town_rect; - preset_item_type preset_items[64]; - short max_num_monst; - preset_field_type preset_fields[50]; - short spec_on_entry,spec_on_entry_if_dead; - short timer_spec_times[8]; - short timer_specs[8]; - unsigned char strlens[180]; - special_node_type specials[100]; - unsigned char specials1,specials2,res1,res2; - short difficulty; - } town_record_type; - - - -typedef struct { - unsigned char terrain[64][64]; - RECT16 room_rect[16]; - creature_start_type creatures[60]; - unsigned char lighting[8][64]; - } big_tr_type; - -typedef struct { - unsigned char terrain[48][48]; - RECT16 room_rect[16]; - creature_start_type creatures[40]; - unsigned char lighting[6][48]; - } ave_tr_type; - -typedef struct { - unsigned char terrain[32][32]; - RECT16 room_rect[16]; - creature_start_type creatures[30]; - unsigned char lighting[4][32]; - } tiny_tr_type; - -typedef struct { - short block_type; - short block_destroy_time; - char block_alignment; - char block_key_time; - location block_loc; - } city_block_type; - -typedef struct { - RECT16 what_rect; - unsigned char ter_type; - unsigned char hollow; - } city_ter_rect_type; - -typedef struct { - creature_start_type creatures[30]; - city_block_type city_block[15]; - city_ter_rect_type city_ter_rect[10]; - } template_town_type; - -typedef struct { - item_record_type scen_items[400]; - char monst_names[256][20]; - char ter_names[256][30]; - } scen_item_data_type; - -typedef struct { - short ter_type,item_num[10],item_odds[10],property; - } item_storage_shortcut_type; - -typedef struct { - unsigned char m_num,level,m_name[26]; - short health,m_health,mp,max_mp; - unsigned char armor,skill; - short a[3]; - unsigned char a1_type,a23_type,m_type,speed,ap,mu,cl,breath,breath_type,treasure,spec_skill,poison; - short morale,m_morale; - short corpse_item,corpse_item_chance; - short status[15]; - unsigned char direction,immunities,x_width,y_width,radiate_1,radiate_2; - unsigned char default_attitude,summon_type,default_facial_pic,res1,res2,res3; - short picture_num; - - } monster_record_type; - -typedef struct { - short active,attitude; - unsigned char number; - location m_loc; - monster_record_type m_d; - Boolean mobile; - short summoned; - creature_start_type monst_start; - } creature_data_type; - - -typedef struct { - location horse_loc,horse_loc_in_sec,horse_sector; - short which_town; - Boolean exists,property; - } horse_record_type; -typedef struct { - location boat_loc,boat_loc_in_sec,boat_sector; - short which_town; - Boolean exists,property; -} boat_record_type; - -typedef struct { - unsigned char flag1, flag2, flag3, flag4; - unsigned char ver[3],min_run_ver,prog_make_ver[3],num_towns; - unsigned char out_width,out_height,difficulty,intro_pic,default_ground; - } scen_header_type; - - typedef struct { - unsigned char flag1, flag2, flag3, flag4; - unsigned char ver[3],min_run_ver,prog_make_ver[3],num_towns; - unsigned char out_width,out_height,difficulty,intro_pic,default_ground; - unsigned char town_size[200]; - unsigned char town_hidden[200],a; - short flag_a; - short intro_mess_pic,intro_mess_len; - location where_start,out_sec_start,out_start; - short which_town_start; - short flag_b; - short town_data_size[200][5]; - short town_to_add_to[10]; - short flag_to_add_to_town[10][2]; - short flag_c; - short out_data_size[100][2]; - RECT16 store_item_rects[3]; - short store_item_towns[3]; - short flag_e; - short special_items[50]; - short special_item_special[50]; - short rating,uses_custom_graphics; - short flag_f; - monster_record_type scen_monsters[256]; - boat_record_type scen_boats[30]; - horse_record_type scen_horses[30]; - short flag_g; - terrain_type_type ter_types[256]; - short scenario_timer_times[20]; - short scenario_timer_specs[20]; - short flag_h; - special_node_type scen_specials[256]; - item_storage_shortcut_type storage_shortcuts[10]; - short flag_d; - unsigned char scen_str_len[300]; - short flag_i; - location last_out_edited; - short last_town_edited; - - } scenario_data_type; - -// for game -typedef struct { - short personality; - short town_num; - short str1,str2; - } talk_save_type; - -typedef struct { - creature_data_type dudes[60]; - short which_town; - short friendly; - } creature_list_type; - -typedef struct { - short town_num, difficulty; - town_record_type town; - char explored[64][64]; - Boolean hostile; - creature_list_type monst; - Boolean in_boat; - location p_loc; - } current_town_type; - -typedef struct { - Boolean exists; - short direction; - out_wandering_type what_monst; - location which_sector,m_loc; - } outdoor_creature_type; - -typedef struct { - long age; - short gold,food; - unsigned char stuff_done[310][10],item_taken[200][8]; - short light_level; - location outdoor_corner,i_w_c,p_loc,loc_in_sec; - boat_record_type boats[30]; - horse_record_type horses[30]; - creature_list_type creature_save[4]; - short in_boat,in_horse; - outdoor_creature_type out_c[10]; - item_record_type magic_store_items[5][10]; - short imprisoned_monst[4]; - char m_seen[256]; - char journal_str[50]; - short journal_day[50]; - short special_notes_str[140][2]; - talk_save_type talk_save[120]; - short direction,at_which_save_slot; - char alchemy[20]; - Boolean can_find_town[200]; - short key_times[100]; - short party_event_timers[30]; - short global_or_town[30]; - short node_to_call[30]; - char spec_items[50],help_received[120]; - short m_killed[200]; - long total_m_killed,total_dam_done,total_xp_gained,total_dam_taken; - char scen_name[256]; - } party_record_type; - -typedef struct { char town_maps[200][8][64];} stored_town_maps_type; -typedef struct { - char town_strs[180][256]; - } piles_of_stuff_dumping_type; -typedef struct { - char scen_header_strs[25][3][80]; - char scen_names[25][256]; - scen_item_data_type scen_item_list; - } piles_of_stuff_dumping_type2; -typedef struct { - char talk_strs[170][256]; - } piles_of_stuff_dumping_type3; -typedef struct { - char out_strs[9][256]; - } outdoor_strs_type; -typedef struct { - outdoor_strs_type outdoor_text[2][2]; - } piles_of_stuff_dumping_type4; -typedef struct { -char scen_strs[160][256]; - } piles_of_stuff_dumping_type5; - -typedef struct { - short main_status; - char name[20]; - short skills[30]; - short max_health,cur_health,max_sp,cur_sp,experience,skill_pts,level; - short status[15]; - item_record_type items[24]; - Boolean equip[24]; - Boolean priest_spells[62],mage_spells[62]; - short which_graphic,weap_poisoned; - Boolean advan[15],traits[15]; - short race,exp_adj,direction; - } pc_record_type; - -typedef struct { - unsigned char setup[4][64][64]; - } setup_save_type; - -typedef struct {unsigned char pattern[9][9];} effect_pat_type; - -typedef struct { - item_record_type items[NUM_TOWN_ITEMS]; - } stored_items_list_type; - -typedef struct { - char outdoor_maps[100][6][48]; - } stored_outdoor_maps_type; - -short s_pow(short x,short y); -short a_v(short x); -short ex_abs(short x); -short get_ran (short times,short min,short max); -Boolean same_point(location p1,location p2); -void pause(short length); -short minmax(short min,short max,short k); -/*short min(short a,short b); -short max(short a,short b);*/ -short move_to_zero(short val); -void Delay(short val,long *dummy); -void alter_rect(RECT *r) ; -Boolean sd_legit(short a, short b); diff --git a/Win32/Blades of Exile Char Editor/GRAPHICS.CPP b/Win32/Blades of Exile Char Editor/GRAPHICS.CPP deleted file mode 100644 index 317bd547..00000000 --- a/Win32/Blades of Exile Char Editor/GRAPHICS.CPP +++ /dev/null @@ -1,1034 +0,0 @@ -#include - -#include "stdio.h" -#include "string.h" -#include "global.h" -#include "graphics.h" -#include "edsound.h" -#include "dlogtool.h" -#include "graphutl.h" - - -extern short store_size; - -/* Adventure globals */ -extern party_record_type party; -extern pc_record_type adven[6]; -extern outdoor_record_type outdoors[2][2]; -extern current_town_type c_town; -extern big_tr_type t_d; -extern stored_items_list_type t_i; -extern unsigned char out[96][96]; -extern unsigned char out_e[96][96]; -extern setup_save_type setup_save; -extern stored_items_list_type stored_items[3]; -extern stored_town_maps_type maps; -extern stored_outdoor_maps_type o_maps; - -extern HWND mainPtr; -extern Boolean play_sounds,file_in_mem; - -extern short store_flags[3]; -extern HBITMAP button_num_gworld; -extern short current_active_pc,ulx,uly; -extern Boolean dialog_not_toast,party_in_scen; -extern char town_strs[180][256]; - -extern HFONT font,italic_font,underline_font,bold_font,tiny_font,small_bold_font; -extern HCURSOR arrow_curs[3][3], sword_curs, boot_curs, key_curs, target_curs,talk_curs,look_curs; -//extern HPALETTE hpal; -extern HDC main_dc,main_dc2,main_dc3; -HBITMAP title_gworld,pc_gworld,dlogpics_gworld,buttons_gworld; -HBITMAP dlg_buttons_gworld,mixed_gworld,dialog_pattern_gworld,pattern_gworld; -RECT whole_win_rect; - RECT title_from = {41,0,380,70}; -extern RECT pc_area_buttons[6][4] ; // 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 - -extern RECT pc_info_rect; // Frame that holds a pc's basic info and items -extern RECT name_rect; -extern RECT pc_race_rect; -extern RECT info_area_rect; -extern RECT hp_sp_rect; -extern RECT skill_rect; -extern RECT pc_skills_rect[19]; -extern RECT status_rect; -extern RECT pc_status_rect[10]; -extern RECT traits_rect; -extern RECT pc_traits_rect[16]; -extern RECT edit_rect[5][2]; -extern HINSTANCE store_hInstance; - -short store_str1a; -short store_str1b; -short store_str2a; -short store_str2b; -short store_which_string_dlog; -short store_page_on,store_num_i; - RECT frame_rect = {0,0,605,440}; -RECT ed_buttons_from[2] = {{0,0,57,57},{57,0,114,57}}; -short current_pressed_button = -1; - -void init_main_buttons() -{ - - short i; - - short indent = 0, indent2 = 0; - RECT base_rect; - RECT active_area_rect = {0,0,590,440}; - - - GetClientRect(mainPtr,&whole_win_rect); - ulx = (whole_win_rect.right - 600) / 2; - uly = (whole_win_rect.bottom - 440) / 2; - - pc_info_rect= active_area_rect; - InflateRect(&pc_info_rect,-100,-100); - pc_info_rect.bottom+=52; - pc_info_rect.top-=25; - pc_info_rect.right+=5; - name_rect.left = pc_info_rect.left; - name_rect.right = pc_info_rect.left + 100; - name_rect.bottom = pc_info_rect.top + 15; - name_rect.top = pc_info_rect.top; - - //Initialize pc_area_buttons - pc_area_buttons[0][0].top=pc_info_rect.top; - pc_area_buttons[0][0].bottom=pc_area_buttons[0][0].top + 57 ; - - for(i = 0; i < 6; i++) - { - pc_area_buttons[i][0].left = 20; - pc_area_buttons[i][0].right = pc_area_buttons[0][0].left + 57; - pc_area_buttons[i][2].left = 20; - pc_area_buttons[i][2].right = pc_area_buttons[i][2].left + 56; - pc_area_buttons[i][3].left = 20; - pc_area_buttons[i][3].right = pc_area_buttons[i][3].left + 56; - pc_area_buttons[i][1].left = 34; - pc_area_buttons[i][1].right = pc_area_buttons[i][1].left + 28; - - pc_area_buttons[i][0].top = pc_area_buttons[0][0].top + 60*i; - pc_area_buttons[i][0].bottom = pc_area_buttons[0][0].bottom + 60*i; - - pc_area_buttons[i][1].top = pc_area_buttons[i][0].top+3; - pc_area_buttons[i][1].bottom = pc_area_buttons[i][2].top = pc_area_buttons[i][0].bottom - 18; - pc_area_buttons[i][2].bottom = pc_area_buttons[i][3].top = pc_area_buttons[i][0].bottom - 9; - pc_area_buttons[i][3].bottom = pc_area_buttons[i][0].bottom; - OffsetRect(&pc_area_buttons[i][2],0,4); - OffsetRect(&pc_area_buttons[i][3],0,-2); - } - - //Initialize the edit_rect buttons - edit_rect[0][0].top = pc_info_rect.top; - for(i = 0; i < 5; i++) { - if(i >= 2) - indent = 7; - else - indent = 0; - if( i == 4) - indent2 = 1; - edit_rect[i][0].top = edit_rect[0][0].top + 66*i; - edit_rect[i][0].bottom = edit_rect[i][0].top + 53; - edit_rect[i][0].left = 510; - edit_rect[i][0].right = edit_rect[i][0].left + 53; - edit_rect[i][1].top = edit_rect[i][0].top + 7 + indent; - edit_rect[i][1].bottom = edit_rect[i][0].bottom - 11 - indent; - edit_rect[i][1].right = edit_rect[i][0].right - 8 +indent2; - edit_rect[i][1].left = edit_rect[i][0].left + 10 + indent2; - } - - //Initialize pc_race_rect - pc_race_rect.top = pc_info_rect.top; - pc_race_rect.bottom = name_rect.bottom; - pc_race_rect.left = name_rect.right; - pc_race_rect.right = pc_info_rect.left + (pc_info_rect.right - pc_info_rect.left)/2; - - //initialize info_area_rect - info_area_rect.top = pc_info_rect.top; - info_area_rect.left = pc_info_rect.left; - info_area_rect.right = pc_race_rect.right; - info_area_rect.bottom = pc_info_rect.bottom; - - // Initialize hp_sp_rect - hp_sp_rect.top = name_rect.bottom + 1; - hp_sp_rect.left = pc_info_rect.left + 1; - hp_sp_rect.right = pc_race_rect.right - 30; - hp_sp_rect.bottom = hp_sp_rect.top + 12; - for (i = 0; i < 6; i++) { - pc_area_buttons[i][3].left = hp_sp_rect.right - 32; - pc_area_buttons[i][3].right = pc_area_buttons[i][3].left + 77; - pc_area_buttons[i][3].top = hp_sp_rect.top + 1; - pc_area_buttons[i][3].bottom = hp_sp_rect.bottom + 1; - } - - // Initialize skill_rect - skill_rect.top = hp_sp_rect.bottom + 2; - skill_rect.left = pc_info_rect.left + 1; - skill_rect.right = pc_race_rect.right; - skill_rect.bottom = skill_rect.top + 12; - - //Initialize skills_rect - base_rect.top = skill_rect.bottom + 1; - base_rect.left = skill_rect.left + 1; - base_rect.right = name_rect.right - 1; - base_rect.bottom = base_rect.top + (pc_info_rect.bottom - skill_rect.bottom)/30; - - for (i = 0; i < 19; i++) { - pc_skills_rect[i] = base_rect; - OffsetRect(&pc_skills_rect[i], (i / 10) * ((name_rect.right)-(name_rect.left)), (i % 10) * (pc_info_rect.bottom - name_rect.bottom)/30); - } - - //Initialize status_rect - status_rect.top = pc_skills_rect[9].bottom + 5; - status_rect.left = pc_info_rect.left + 1; - status_rect.right = pc_race_rect.right; - status_rect.bottom = status_rect.top + 12; - //Initialize pc_status_rect - base_rect.top = status_rect.bottom + 1; - base_rect.left = status_rect.left + 1; - base_rect.right = name_rect.right - 1; - base_rect.bottom = base_rect.top + (pc_info_rect.bottom - status_rect.bottom)/15; - for (i = 0; i < 10; i++) { - pc_status_rect[i] = base_rect; - OffsetRect(&pc_status_rect[i], (i / 5) * ((name_rect.right)-(name_rect.left)), (i % 5) * (pc_info_rect.bottom - status_rect.bottom)/15); - } - //Initialize traits_rect - traits_rect.top = pc_status_rect[4].bottom + 5; - traits_rect.left = pc_info_rect.left + 1; - traits_rect.right = pc_race_rect.right; - traits_rect.bottom = traits_rect.top + 12; - //Initialize pc_traits_rect - base_rect.top = traits_rect.bottom - 1; - base_rect.left = traits_rect.left + 1; - base_rect.right = name_rect.right - 1; - base_rect.bottom = base_rect.top + 10; - for (i = 0; i < 16; i++) { - pc_traits_rect[i] = base_rect; - OffsetRect(&pc_traits_rect[i], (i / 7) * ((name_rect.right)-(name_rect.left)), (i % 7) * 10); - } - - - item_string_rects[0][0].top = pc_info_rect.top + 3; - item_string_rects[0][0].left = pc_info_rect.left + (pc_info_rect.right - pc_info_rect.left)/2; - item_string_rects[0][0].right = pc_info_rect.right; - item_string_rects[0][0].bottom = item_string_rects[0][0].top + 12; - for (i = 1; i < 24; i++) { - item_string_rects[i][0] = item_string_rects[0][0]; - OffsetRect(&item_string_rects[i][0],0,13 * i); - } - for (i = 0; i < 24; i++) { - item_string_rects[i][1] = item_string_rects[i][0]; - item_string_rects[i][1].right -= 14; - item_string_rects[i][1].left = item_string_rects[i][1].right - 14; - item_string_rects[i][2] = item_string_rects[i][0]; - item_string_rects[i][2].left = item_string_rects[i][2].right - 14; - } - for (i = 0; i < 24; i++) { - item_string_rects[i][0].left += 2; - item_string_rects[i][0].bottom++; - } - - name_rect.left -= 2; - pc_info_rect.left -= 2; - info_area_rect.left -= 2; - -} - -void Set_up_win () -{ - - - main_dc = GetDC(mainPtr); - - dlg_buttons_gworld = load_pict(2000,main_dc); - title_gworld = load_pict(5000,main_dc); - //SelectPalette(main_dc,hpal,0); - SelectObject(main_dc,font); - SetBkMode(main_dc,TRANSPARENT); - main_dc2 = CreateCompatibleDC(main_dc); - SetMapMode(main_dc2,GetMapMode((HDC) mainPtr)); - //SelectPalette(main_dc2,hpal,0); - main_dc3 = CreateCompatibleDC(main_dc); - SetMapMode(main_dc3,GetMapMode((HDC) mainPtr)); - //SelectPalette(main_dc3,hpal,0); - - mixed_gworld = load_pict(903,main_dc); - - pc_gworld = load_pict(902,main_dc); - dlogpics_gworld = load_pict(850,main_dc); - - buttons_gworld = load_pict(5001,main_dc); - pattern_gworld = CreateCompatibleBitmap(main_dc,192,256); - dialog_pattern_gworld = CreateCompatibleBitmap(main_dc,192,256); -} - -void lose_graphics() -{ - DeleteObject(title_gworld); - DeleteObject(pc_gworld); - DeleteObject(mixed_gworld); - DeleteObject(dlogpics_gworld); - DeleteObject(dlg_buttons_gworld); - DeleteObject(pattern_gworld); - DeleteObject(dialog_pattern_gworld); - //DeleteObject(hpal); - DeleteDC(main_dc); - DeleteDC(main_dc2); - DeleteDC(main_dc3); - DeleteObject(font); - DeleteObject(underline_font); - DeleteObject(italic_font); - DeleteObject(bold_font); - - DeleteObject(sword_curs); -} - -void redraw_screen() -{ - draw_main_screen(); - display_party(6,1); - draw_items(1); -} - -void draw_main_screen() -{ - RECT source_rect, dest_rec,dest_rect; - RECT reg_rect; - RECT top_pic_from = {3,16,41,54}; - - - paint_pattern(NULL,3,whole_win_rect,3); - - dest_rec = source_rect = title_from; - OffsetRect(&dest_rec,20,6); - - rect_draw_some_item (title_gworld,source_rect, title_gworld,dest_rec, 1,1); - dest_rec = top_pic_from; - OffsetRect(&dest_rec,20,6); - rect_draw_some_item (title_gworld,top_pic_from, title_gworld,dest_rec, 0,1); - - dest_rect = dest_rec; - dest_rect.top = dest_rect.bottom; - dest_rect.bottom = dest_rect.top + 50; - dest_rect.right += 40; - dest_rect.left -=5; - SelectObject(main_dc,bold_font); - char_win_draw_string(main_dc,dest_rect,"Your party:",0,10); - - dest_rec = whole_win_rect; - InflateRect(&dest_rec,-10,-10); - - if ((ulx >= 5) && (uly >= 5) && - (whole_win_rect.right - 30 > frame_rect.right)) - frame_dlog_rect(mainPtr,frame_rect,0); - - frame_dlog_rect(mainPtr,pc_info_rect,0); // draw the frame - - dest_rect = pc_area_buttons[5][0]; - dest_rect.right = whole_win_rect.right - 30; //What is this for? Commenting it out has no effect. - dest_rect.left += 60; - OffsetRect(&dest_rect,0,21); - if (file_in_mem == TRUE) - char_win_draw_string(main_dc,dest_rect,"Click on character to edit it.",0,10); - else char_win_draw_string(main_dc,dest_rect,"Select Open from File menu.",0,10); - OffsetRect(&dest_rect,0,12); - if (file_in_mem == TRUE) - char_win_draw_string(main_dc,dest_rect,"Press 'I' button to identify item, and 'D' button to drop item.",0,10); - OffsetRect(&dest_rect,0,16); - if (file_in_mem == TRUE) - char_win_draw_string(main_dc,dest_rect,"Back up save file before editing it!",0,10); - OffsetRect(&dest_rect,275,0); - char_win_draw_string(main_dc,dest_rect,"Released under the GNU GPL, Version 2",0,10); - - reg_rect.right = pc_info_rect.right + 100; - reg_rect.left = reg_rect.right - 170; - reg_rect.top = pc_info_rect.top - 70; - reg_rect.bottom = pc_info_rect.top; - -} - -void do_button_action(short,short which_button) -{ - long dummy; - - current_pressed_button = which_button; - display_party(6,0); - play_sound(34); - Delay(10,&dummy); - current_pressed_button = -1; - display_party(6,0); -} - - -//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 - -void draw_items(short clear_first) -//short clear_first; // 0 - redraw over, 1 - don't redraw over -{ - short i; - char to_draw[256]; - RECT d_from = {28,12,42,24},i_from = {42,12,56,24}; - - if (file_in_mem == FALSE) - return; - -// dest_rect = item_string_rects[0][0]; -// dest_rect.bottom += 3; -// OffsetRect(&dest_rect,0,-14); - - if (clear_first == 1) { - for (i = 0; i < 24; i++) - paint_pattern(NULL,1,item_string_rects[i][0],3); -// paint_pattern(NULL,1,dest_rect,3); - } - - // frame_dlog_rect(mainPtr,frame_rect,0); - if (adven[current_active_pc].main_status != 1){ - frame_dlog_rect(mainPtr,pc_info_rect,0); // re draw entire frame - frame_dlog_rect(mainPtr,info_area_rect,0); // draw the frame - frame_dlog_rect(mainPtr,pc_race_rect,0); // draw the frame - return; // If PC is dead, it has no items - } - for (i = 0; i < 24; i++) // Loop through items and draw each - if (adven[current_active_pc].items[i].variety > 0) { // i.e. does item exist - sprintf((char *) to_draw, ""); - if (adven[current_active_pc].items[i].item_properties % 2 == 0) - sprintf((char *) to_draw, "%d. %s ",i + 1,adven[current_active_pc].items[i].name); - else if (adven[current_active_pc].items[i].charges > 0) - sprintf((char *) to_draw, "%d. %s (%d)",i + 1,adven[current_active_pc].items[i].full_name, - adven[current_active_pc].items[i].charges); - else sprintf((char *) to_draw, "%d. %s ",i + 1,adven[current_active_pc].items[i].full_name); - - char_win_draw_string(main_dc,item_string_rects[i][0],(char *) to_draw,0,10); - - //Draw id/drop buttons - rect_draw_some_item(mixed_gworld,d_from,mixed_gworld,item_string_rects[i][1],1,1); - rect_draw_some_item(mixed_gworld,i_from,mixed_gworld,item_string_rects[i][2],1,1); - } - frame_dlog_rect(mainPtr,pc_info_rect,0); // re draw entire frame - frame_dlog_rect(mainPtr,name_rect,0); // draw the frame - frame_dlog_rect(mainPtr,pc_race_rect,0); // draw the frame - frame_dlog_rect(mainPtr,info_area_rect,0); // draw the frame - -} - -void display_party(short,short clear_first) -//short mode; // 0 - 5 this pc, 6 - all -//short clear_first; // 0 - redraw over, 1 - don't redraw over -{ - short i; - char to_draw[256],skill_value[256]; - - RECT from_base = {0,0,28,36},from_rect; - COLORREF colors[4] = {RGB(0,0,0),RGB(255,0,0),RGB(0,0,102),RGB(255,255,255)}; - //UINT c[4]; - - - short k,string_num, cur_rect=0; - RECT no_party_rect,temp_rect; - - /*c[0] = GetNearestPaletteIndex(hpal,colors[0]); - c[1] = GetNearestPaletteIndex(hpal,colors[1]); - c[2] = GetNearestPaletteIndex(hpal,colors[2]); - c[3] = GetNearestPaletteIndex(hpal,colors[3]);*/ - if (clear_first == 1) { // first erase what's already there - for (i = 0; i < 6; i++) - paint_pattern(NULL,1,pc_area_buttons[i][0],3); - paint_pattern(NULL,1,name_rect,3); - paint_pattern(NULL,1,pc_race_rect,3); - paint_pattern(NULL,1,info_area_rect,3); - frame_dlog_rect(mainPtr,pc_info_rect,0); // re-draw the frame - } - - - SelectObject(main_dc,bold_font); - if (file_in_mem == FALSE) { - no_party_rect=pc_info_rect; - no_party_rect.top+=5; - no_party_rect.left+=5; - char_win_draw_string(main_dc,no_party_rect,"No party loaded.",0,10); - } - else { - - char buffer[256]; - - from_rect = title_from; //draw gold, food and day variables - from_rect.top = from_rect.bottom-10; - from_rect.left += 57; - from_rect.right += 300; - if(party_in_scen == FALSE) - sprintf(buffer,"Food: %d Gold: %d Day: %d",party.food,party.gold,(party.age/3700)+1); - else{ - if(store_flags[0] == 5790) - sprintf(buffer,"Food: %d Gold: %d Day: %d Party is outdoor",party.food,party.gold,(party.age/3700)+1); - else - sprintf(buffer,"Food: %d Gold: %d Day: %d Party in %s",party.food,party.gold,(party.age/3700)+1,town_strs[0]); - } - char_win_draw_string(main_dc,from_rect,buffer,0,10); - - /* from_rect = title_from; //town variable - from_rect.top = from_rect.bottom - 10; - from_rect.left += 300; - from_rect.right = from_rect.left + 300; - if(store_flags[0] == 5790) - sprintf(buffer,"Party is outdoor"); - else - sprintf(buffer,"In Town : %s ",town_strs[0]); - char_win_draw_string(main_dc,from_rect,buffer,0,10);*/ - - from_rect = title_from; - from_rect.bottom += 385; - from_rect.top = from_rect.bottom - 14; - from_rect.left -= 40; - from_rect.right = from_rect.left + 604; - if (party_in_scen == FALSE) - char_win_draw_string(main_dc,from_rect," Party not in a scenario.",0,10); - else { - char buf[256]; - sprintf(buf," Party is in : %s.",party.scen_name); - char_win_draw_string(main_dc,from_rect,buf,0,10); - } - from_rect.left -= 1; - from_rect.top -= 1; - frame_dlog_rect(mainPtr,from_rect,0); - - for (i = 0; i < 6; i++) { - if (i == current_active_pc) - SetTextColor(main_dc,colors[1]); - else SetTextColor(main_dc,colors[0]); - - from_rect = (current_pressed_button == i) ? ed_buttons_from[1] : ed_buttons_from[0]; - - if ((current_pressed_button < 0) || (current_pressed_button == i)) - rect_draw_some_item(buttons_gworld,from_rect,buttons_gworld,pc_area_buttons[i][0],0,1); - SetTextColor(main_dc,colors[0]); - - // pc_record_type adven[6] is the records that contains characters - // main_status determins 0 - not exist, 1 - alive, OK, 2 - dead, 3 - stoned, 4 - dust - if (adven[i].main_status != 0) { // PC exists? - from_rect = from_base; - // draw PC graphic - OffsetRect(&from_rect,56 * (adven[i].which_graphic / 8),36 * (adven[i].which_graphic % 8)); - rect_draw_some_item(pc_gworld,from_rect,pc_gworld,pc_area_buttons[i][1],0,1); - frame_dlog_rect(mainPtr,pc_area_buttons[i][1],0); // re-draw the frame - - //frame_dlog_rect((GrafPtr) mainPtr,pc_area_buttons[i][1],0); - // draw name - //TextSize(9); - if( (strlen(adven[i].name)) >= 0) { - //TextFace(0); - SelectObject(main_dc,font); - sprintf((char *) to_draw, "%-s", (char *) adven[i].name); - //TextSize(6); - } - else { - sprintf((char *) to_draw, "%-s", (char *) adven[i].name); - } - - if (i == current_active_pc) - SetTextColor(main_dc,colors[1]); - else SetTextColor(main_dc,colors[3]); - win_draw_string(main_dc,pc_area_buttons[i][2],to_draw,1,10); - SelectObject(main_dc,bold_font); - - - if (i == current_active_pc){ - sprintf((char *) to_draw, "%-.18s ", (char *) adven[i].name); - if( (strlen(adven[i].name)) > 12) - SelectObject(main_dc,font); - SetTextColor(main_dc,colors[0]); - win_draw_string(main_dc,name_rect,to_draw,1,10); - SelectObject(main_dc,bold_font); - } - if ((current_pressed_button < 0) || (current_pressed_button == i)) - switch (adven[i].main_status) { - // draw statistics - case 1: - if (i == current_active_pc) { - //Draw in race - if (adven[i].race == 0) - char_win_draw_string(main_dc,pc_race_rect,"Human ",1,10); - if (adven[i].race == 1) - char_win_draw_string(main_dc,pc_race_rect,"Nephilim ",1,10); - if (adven[i].race == 2) - char_win_draw_string(main_dc,pc_race_rect,"Slithzerikai ",1,10); - // Draw in skills - - sprintf((char *) to_draw, "Skills:"); - win_draw_string(main_dc,skill_rect,to_draw,0,10); - sprintf((char *) to_draw, "Hp: %d/%d Sp: %d/%d",adven[i].cur_health,adven[i].max_health,adven[i].cur_sp, - adven[i].max_sp); - win_draw_string(main_dc,hp_sp_rect,to_draw,0,10); - - - SelectObject(main_dc,font); - string_num=1; - for( k = 0; k < 19 ; ++k) - { - temp_rect = pc_skills_rect[k]; - temp_rect.left = pc_skills_rect[k].left + ((k < 10) ? 90 : 83); - - get_str(to_draw,9,string_num); - win_draw_string(main_dc,pc_skills_rect[k],to_draw,0,9); - - sprintf((char *) skill_value,"%d",adven[i].skills[k]); - OffsetRect(&temp_rect,-8,0); - temp_rect.right += 10; - win_draw_string(main_dc,temp_rect,skill_value,0,9); - //frame_dlog_rect((GrafPtr) mainPtr,pc_skills_rect[k],0); - string_num+=2; - } - //end skills - - //Write in pc Status - SelectObject(main_dc,bold_font); - sprintf((char *) to_draw, "Status:"); - win_draw_string(main_dc,status_rect,to_draw,0,10); - - SelectObject(main_dc,font); - //for(k = 0 ; k < 10; k++) - //frame_dlog_rect((GrafPtr) mainPtr,pc_status_rect[k],0); - if (adven[i].status[0] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Poisoned Weap.",0,9); - cur_rect++; - } - if (adven[i].status[1] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Blessed",0,9); - cur_rect++; - } - else if(adven[i].status[1] < 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Cursed",0,9); - cur_rect++; - } - if (adven[i].status[2] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Poisoned",0,9); - cur_rect++; - } - if (adven[i].status[3] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Hasted",0,9); - cur_rect++; - } - else if(adven[i].status[3] < 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Slowed",0,9); - cur_rect++; - } - if (adven[i].status[4] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Invulnerable",0,9); - cur_rect++; - } - if (adven[i].status[5] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Magic Resistant",0,9); - cur_rect++; - } - if (adven[i].status[6] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Webbed",0,9); - cur_rect++; - } - if (adven[i].status[7] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Diseased",0,9); - cur_rect++; - } - if (adven[i].status[8] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Sanctury",0,9); - cur_rect++; - } - if (adven[i].status[9] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Dumbfounded",0,9); - cur_rect++; - } - if (adven[i].status[10] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Martyr's Shield",0,9); - cur_rect++; - } - if (adven[i].status[11] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Asleep",0,9); - cur_rect++; - } - if (adven[i].status[12] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Paralyzed",0,9); - cur_rect++; - } - if (adven[i].status[13] > 0) - if(cur_rect <= 9) { - char_win_draw_string(main_dc,pc_status_rect[cur_rect],"Acid",0,9); - cur_rect++; - } - //end pc status section - - //Write in Traits - SelectObject(main_dc,bold_font); - sprintf((char *) to_draw, "Traits:"); - win_draw_string(main_dc,traits_rect,to_draw,0,10); - SelectObject(main_dc,font); - cur_rect=0; - if (adven[i].traits[0] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Toughness",0,9); - cur_rect++; - } - if (adven[i].traits[1] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Magically Apt",0,9); - cur_rect++; - } - if (adven[i].traits[2] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Ambidextrous",0,9); - cur_rect++; - } - if (adven[i].traits[3] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Nimble Fingers",0,9); - cur_rect++; - } - if (adven[i].traits[4] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Cave Lore",0,9); - cur_rect++; - } - - if (adven[i].traits[5] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Woodsman",0,9); - cur_rect++; - } - if (adven[i].traits[6] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Good Constitution",0,9); - cur_rect++; - } - if (adven[i].traits[7] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Highly Alert",0,9); - cur_rect++; - } - if (adven[i].traits[8] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Exceptional Str.",0,9); - cur_rect++; - } - if (adven[i].traits[9] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Recuperation",0,9); - cur_rect++; - } - if (adven[i].traits[10] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Sluggish",0,9); - cur_rect++; - } - if (adven[i].traits[11] == 1) - if(cur_rect <= 15) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Magically Inept",0,9); - cur_rect++; - } - if (adven[i].traits[12] == 1) - if(cur_rect <= 14) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Frail",0,9); - cur_rect++; - } - if (adven[i].traits[13] == 1) - if(cur_rect <= 14) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Chronic Disease",0,9); - cur_rect++; - } - if (adven[i].traits[14] == 1) - if(cur_rect <= 13) { - char_win_draw_string(main_dc,pc_traits_rect[cur_rect],"Bad Back",0,9); - cur_rect++; - } - - //end traits - - - SetTextColor(main_dc,colors[0]); - SelectObject(main_dc,bold_font); - char_win_draw_string(main_dc,pc_area_buttons[i][3],"Alive ",1,10); - SelectObject(main_dc,bold_font); - } - break; - case 2: - if (i == current_active_pc){ - SetTextColor(main_dc,colors[0]); - SelectObject(main_dc,bold_font); - char_win_draw_string(main_dc,pc_area_buttons[i][3],"Dead ",1,10); - SelectObject(main_dc,bold_font); - break; - } - case 3: - if (i == current_active_pc){ - SetTextColor(main_dc,colors[0]); - SelectObject(main_dc,bold_font); - char_win_draw_string(main_dc,pc_area_buttons[i][3],"Dust ",1,10); - SelectObject(main_dc,bold_font); - break; - } - case 4: - if (i == current_active_pc){ - SetTextColor(main_dc,colors[0]); - SelectObject(main_dc,bold_font); - char_win_draw_string(main_dc,pc_area_buttons[i][3],"Stone ",1,10); - SelectObject(main_dc,bold_font); - break; - } - case 5: - if (i == current_active_pc){ - SetTextColor(main_dc,colors[0]); - SelectObject(main_dc,bold_font); - char_win_draw_string(main_dc,pc_area_buttons[i][3],"Fled ",1,10); - SelectObject(main_dc,bold_font); - break; - } - case 6: - if (i == current_active_pc){ - SetTextColor(main_dc,colors[0]); - SelectObject(main_dc,bold_font); - char_win_draw_string(main_dc,pc_area_buttons[i][3],"Surface ",1,10); - SelectObject(main_dc,bold_font); - break; - } - default: - if (i == current_active_pc){ - SetTextColor(main_dc,colors[0]); - SelectObject(main_dc,bold_font); - char_win_draw_string(main_dc,pc_area_buttons[i][3],"Absent ",1,10); - SelectObject(main_dc,bold_font); - break; - } - } - //frame_dlog_rect((GrafPtr) mainPtr,pc_area_buttons[i][0],0); - - - } - - } // Closes the for i=6 loop - SetTextColor(main_dc,colors[0]); - - for(i = 0; i < 5; i++) - if ((current_pressed_button < 0) || (current_pressed_button == i + 10)) { - if (clear_first == 1) { // first erase what's already there - paint_pattern(NULL,1,edit_rect[i][0],3); - } - - from_rect = (current_pressed_button == i + 10) ? ed_buttons_from[1] : ed_buttons_from[0]; - rect_draw_some_item(buttons_gworld,from_rect,buttons_gworld,edit_rect[i][0],0,1); - SetTextColor(main_dc,colors[3]); - switch(i) { - case 0: - char_win_draw_string(main_dc,edit_rect[0][1]," Add|Mage|Spells ",0,10); - break; - case 1: - char_win_draw_string(main_dc,edit_rect[1][1]," Add|Priest|Spells ",0,10); - break; - case 2: - char_win_draw_string(main_dc,edit_rect[2][1]," Edit|Traits",0,10); - break; - case 3: - char_win_draw_string(main_dc,edit_rect[3][1]," Edit|Skills",0,10); - break; - case 4: - char_win_draw_string(main_dc,edit_rect[4][1]," Edit| XP",0,10); - break; - default: - break; - } - SetTextColor(main_dc,colors[0]); - - } - - } -SetTextColor(main_dc,colors[0]); -} - -void display_strings_event_filter (short item_hit) -{ - - - - switch (item_hit) { - case 1: - dialog_not_toast = FALSE; - break; - } -} - -void display_strings(short str1a,short str1b,short str2a,short str2b, - char *title,short sound_num,short graphic_num,short parent_num) -{ - - - char sign_text[256]; - - - - make_cursor_sword(); - - store_str1a = str1a; - store_str1b = str1b; - store_str2a = str2a; - store_str2b = str2b; - - if ((str1a <= 0) || (str1b <= 0)) - return; - store_which_string_dlog = 970; - if (strlen(title) > 0) - store_which_string_dlog += 2; - if ((str2a > 0) && (str2b > 0)) - store_which_string_dlog++; - cd_create_dialog_parent_num(store_which_string_dlog,parent_num); - - cd_activate_item(store_which_string_dlog,2,0); - - csp(store_which_string_dlog,store_which_string_dlog,graphic_num); - - get_str(sign_text,str1a,str1b); - csit(store_which_string_dlog,4,(char *) sign_text); - if ((str2a > 0) && (str2b > 0)) { - get_str(sign_text,str2a,str2b); - csit(store_which_string_dlog,5,(char *) sign_text); - } - if (strlen(title) > 0) - csit(store_which_string_dlog,6,title); - csp(store_which_string_dlog,3,graphic_num); - if (sound_num >= 0) - play_sound(sound_num); - while (dialog_not_toast) - ModalDialog(); - - cd_kill_dialog(store_which_string_dlog,0); -} - -void get_str(char *str,short i, short j) -{ - GetIndString(str, i, j); -} - -void char_win_draw_string(HDC dest_window,RECT dest_rect,char *str,short mode,short line_height) -{ - char store_s[256]; - - strcpy((char *) store_s,str); - win_draw_string( dest_window, dest_rect,store_s, mode, line_height); - -} - -// mode: 0 - align up and left, 1 - center on one line -// str is a c string, 256 characters -// uses current font -void win_draw_string(HDC dest_hdc,RECT dest_rect,char *str,short mode,short) -{ - short i; - -// this will need formatting for '|' line breaks - for (i = 0; i < 256; i++) { - if (str[i] == '|') - str[i] = 13; - if (str[i] == '_') - str[i] = 34; - } - // if dest is main window, add ulx, uly - if (dest_hdc == main_dc) - OffsetRect(&dest_rect,ulx,uly); - switch (mode) { - case 0: - dest_rect.bottom += 6; - DrawText(dest_hdc,str,strlen((char *)str),&dest_rect,DT_LEFT | DT_WORDBREAK); break; - case 1: - dest_rect.bottom += 6; dest_rect.top -= 6; - DrawText(dest_hdc,str,strlen((char *)str),&dest_rect, - DT_CENTER | DT_VCENTER | DT_NOCLIP | DT_SINGLELINE); break; - case 2: case 3: - dest_rect.bottom += 6; dest_rect.top -= 6; - DrawText(dest_hdc,str,strlen((char *)str),&dest_rect, - DT_LEFT | DT_VCENTER | DT_NOCLIP | DT_SINGLELINE); break; - } - // not yet done adjusts for 1, 2, 3 - -} - -short string_length(char *str,HDC hdc) -{ - short text_len[257]; - short total_width = 0,i,len; - char p_str[256]; - - for (i = 0; i < 257; i++) - text_len[i]= 0; - - strcpy((char *) p_str,str); - MeasureText(256,p_str,text_len,hdc); - len = strlen((char *)str); - - for (i = 0; i < 257; i++) - if ((text_len[i] > total_width) && (i <= len)) - total_width = text_len[i]; - return total_width; -} - -// Note ... this expects a str len of at most 256 and -// len_array pointing to a 256 long array of shorts -void MeasureText(short str_len,char *str, short *len_array,HDC hdc) -{ - short text_len[257]; - short i; - char p_str[257]; - SIZE val_returned; - char *store_array; - short *store2; - - store_array = (char *) len_array; - for (i = 0; i < 256; i++) - text_len[i] = 0; - for (i = 1; i < str_len; i++) { - strncpy(p_str,str,i); - p_str[i] = 0; - GetTextExtentPoint32(hdc,p_str,i, &val_returned); - text_len[i] = val_returned.cx; - } - for (i = 0; i < 256; i++) { - store2 = (short *) store_array; - *store2 = text_len[i]; - store_array += 2; - } - } - - -void GetIndString(char *str,short i, short j) { - UINT resnum = 0,len; - short k; - - resnum = i * 300 + j; - - len = LoadString(store_hInstance,resnum,str,256); - if (len == 0) { - sprintf(str,""); - return; - } - for (k = 0; k < 256; k++) { - if (str[k] == '|') - str[k] = 13; - if (str[k] == '_') - str[k] = 34; - } -} - - -void make_cursor_sword() -{ - SetCursor(sword_curs); -} diff --git a/Win32/Blades of Exile Char Editor/GRAPHICS.H b/Win32/Blades of Exile Char Editor/GRAPHICS.H deleted file mode 100644 index 3c6712ed..00000000 --- a/Win32/Blades of Exile Char Editor/GRAPHICS.H +++ /dev/null @@ -1,25 +0,0 @@ -void init_main_buttons(); -void Set_up_win (); -void redraw_screen(); -void draw_main_screen(); -void do_button_action(short which_pc,short which_button); -void draw_items(short clear_first); -void display_party(short mode,short clear_first); - - -void char_win_draw_string(HDC dest_window,RECT dest_rect,char *str,short mode,short line_height); -void win_draw_string(HDC dest_hdc,RECT dest_rect,char *str,short mode,short line_height); -void display_strings_event_filter (short item_hit); -void display_strings(short str1a,short str1b,short str2a,short str2b, - char *title,short sound_num,short graphic_num,short parent_num); -void c2p(char *str) ; -void p2c(char *str); -void get_str(char *,short i, short j); -short string_length(char *str,HDC hdc); -void make_cursor_sword(); - -void MeasureText(short str_len,char *str, short *len_array,HDC hdc); -void GetIndString(char *str,short i, short j) ; - -void lose_graphics(); - diff --git a/Win32/Blades of Exile Char Editor/GRAPHUTL.CPP b/Win32/Blades of Exile Char Editor/GRAPHUTL.CPP deleted file mode 100644 index 7336c4e8..00000000 --- a/Win32/Blades of Exile Char Editor/GRAPHUTL.CPP +++ /dev/null @@ -1,333 +0,0 @@ -#define xmin(a,b) ((a) < (b) ? (a) : (b)) - -#include -#include -#include -#include -#include -#include -#include "global.h" - - -#include "edsound.h" - -#include "graphutl.h" - -extern HWND mainPtr; -//extern HPALETTE hpal; -extern HDC main_dc,main_dc2,main_dc3; -extern short ulx,uly; -extern HBITMAP mixed_gworld,dialog_pattern_gworld,pattern_gworld,status_pattern_gworld; -extern char file_path_name[256]; - - int elements[5] = {COLOR_ACTIVEBORDER,COLOR_ACTIVECAPTION, - COLOR_WINDOWFRAME,COLOR_SCROLLBAR,COLOR_BTNFACE}; - COLORREF store_element_colors[5]; -short dlog_pat_placed = 0; -short current_pattern = -1; - -HBITMAP load_pict(short pict_num,HDC model_hdc) -{ - HBITMAP got_bitmap; - - switch(pict_num) { - case 700: case 701: case 702: got_bitmap = ReadBMP("images/STATAREA.BMP"); break; - case 703: got_bitmap = ReadBMP("images/TEXTBAR.BMP"); break; - case 704: got_bitmap = ReadBMP("images/BUTTONS.BMP"); break; - case 705: got_bitmap = ReadBMP("images/TERSCRN.BMP"); break; - case 800: got_bitmap = ReadBMP("images/TER1.BMP"); break; - case 801: got_bitmap = ReadBMP("images/TER2.BMP"); break; - case 802: got_bitmap = ReadBMP("images/TER3.BMP"); break; - case 803: got_bitmap = ReadBMP("images/TER4.BMP"); break; - case 804: got_bitmap = ReadBMP("images/TER5.BMP"); break; - case 805: got_bitmap = ReadBMP("images/TER6.BMP"); break; - case 820: got_bitmap = ReadBMP("images/TERANIM.BMP"); break; - case 821: got_bitmap = ReadBMP("images/FIELDS.BMP"); break; - case 830: got_bitmap = ReadBMP("images/STARTUP.BMP"); break; - case 850: got_bitmap = ReadBMP("images/DLOGPICS.BMP"); break; - case 860: got_bitmap = ReadBMP("images/TALKPORT.BMP"); break; - case 875: got_bitmap = ReadBMP("images/DLOGMAPS.BMP"); break; - case 880: got_bitmap = ReadBMP("images/MISSILES.BMP"); break; - case 900: got_bitmap = ReadBMP("images/TINYOBJ.BMP"); break; - case 901: got_bitmap = ReadBMP("images/OBJECTS.BMP"); break; - case 902: got_bitmap = ReadBMP("images/PCS.BMP"); break; - case 905: got_bitmap = ReadBMP("images/PCS.BMP"); break; - case 903: case 904: got_bitmap = ReadBMP("images/MIXED.BMP"); break; - case 1100: case 1200: got_bitmap = ReadBMP("images/MONST1.BMP"); break; - case 1101: case 1201: got_bitmap = ReadBMP("images/MONST2.BMP"); break; - case 1102: case 1202: got_bitmap = ReadBMP("images/MONST3.BMP"); break; - case 1103: case 1203: got_bitmap = ReadBMP("images/MONST4.BMP"); break; - case 1104: case 1204: got_bitmap = ReadBMP("images/MONST5.BMP"); break; - case 1105: case 1205: got_bitmap = ReadBMP("images/MONST6.BMP"); break; - case 1106: case 1206: got_bitmap = ReadBMP("images/MONST7.BMP"); break; - case 1107: case 1207: got_bitmap = ReadBMP("images/MONST8.BMP"); break; - case 1108: case 1208: got_bitmap = ReadBMP("images/MONST9.BMP"); break; - case 1109: case 1209: got_bitmap = ReadBMP("images/MONST10.BMP"); break; - case 1400: got_bitmap = ReadBMP("images/STSCICON.BMP"); break; - case 1401: got_bitmap = ReadBMP("images/HELPPICS.BMP"); break; - case 1402: got_bitmap = ReadBMP("images/APPIC.BMP"); break; - case 1500: case 1501: case 1502: case 1503: case 1504: case 1505: case 1506: case 1507: - got_bitmap = ReadBMP("images/BIGMAPS.BMP"); break; - case 2000: got_bitmap = ReadBMP("images/DLOGBTNS.BMP"); break; - case 3000: got_bitmap = ReadBMP("images/START.BMP"); break; - case 3001: got_bitmap = ReadBMP("images/SPIDLOGO.BMP"); break; - case 5000: got_bitmap = ReadBMP("images/BLEDTITL.BMP"); break; - case 5001: got_bitmap = ReadBMP("images/PCEDBTNS.BMP"); break; - - default: got_bitmap = NULL; - } - return got_bitmap; -} - -void rect_draw_some_item(HBITMAP src,RECT src_rect,HBITMAP dest,RECT dest_rect, - short trans, short main_win) { - HDC hdcMem,hdcMem2,hdcMem3,destDC; - HBITMAP transbmp; - COLORREF white = RGB(255,255,255),oldcolor; - - HBRUSH hbrush,old_brush; - UINT c; - HBITMAP store,store2; - Boolean dlog_draw = FALSE; - - if (main_win == 2) { - destDC = (HDC) dest; - main_win = 1; - dlog_draw = TRUE; - hdcMem = CreateCompatibleDC(destDC); - SelectObject(hdcMem, src); - SetMapMode(hdcMem,GetMapMode((HDC) mainPtr)); - //SelectPalette(hdcMem,hpal,0); - } - else { - destDC = main_dc; - hdcMem = main_dc2; - store = (HBITMAP) SelectObject(hdcMem,src); - } - - if (trans != 1) { - if (main_win == 0) { // Not transparent, into bitmap - hdcMem2 = main_dc3; - store2 = (HBITMAP) SelectObject(hdcMem2, dest); - StretchBlt(hdcMem2,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,(trans >= 0) ? SRCCOPY : SRCAND); - SelectObject(hdcMem2,store2); - } - - else { // Not transparent, onto screen - if (trans == 2) { - //c = GetNearestPaletteIndex(hpal,x); - hbrush = CreateSolidBrush(PALETTEINDEX(c)); - old_brush = (HBRUSH) SelectObject(destDC,hbrush); - - } - if (dlog_draw == FALSE) - SetViewportOrgEx(destDC,ulx,uly, NULL); - - StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,(trans == 0) ? SRCCOPY : PATCOPY); - if (trans == 2) { - SelectObject(destDC,old_brush); - if (DeleteObject(hbrush) == 0) - play_sound(1); - } - if (dlog_draw == FALSE) - SetViewportOrgEx(destDC,0,0,NULL); - - - } - } // end of non-transparent draws - else { - if (main_win == 0) { - hdcMem3 = CreateCompatibleDC(hdcMem); - SelectObject(hdcMem3, dest); - SetMapMode(hdcMem3,GetMapMode((HDC) mainPtr)); - //SelectPalette(hdcMem3,hpal,0); - transbmp = CreateBitmap(src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,1,1,NULL); - hdcMem2 = CreateCompatibleDC(destDC); - SelectObject(hdcMem2, transbmp); - oldcolor = SetBkColor(hdcMem, white); - StretchBlt(hdcMem2,0,0,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCCOPY); - SetBkColor(hdcMem, oldcolor); - - StretchBlt(hdcMem3,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCINVERT); - StretchBlt(hdcMem3,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem2,0,0,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCAND); - StretchBlt(hdcMem3,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCINVERT); - DeleteDC(hdcMem3); - DeleteDC(hdcMem2); - - DeleteObject(transbmp); - } - else { - if (dlog_draw == FALSE) - SetViewportOrgEx(destDC,ulx,uly,NULL); - transbmp = CreateBitmap(src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,1,1,NULL); - hdcMem2 = CreateCompatibleDC(destDC); - SelectObject(hdcMem2, transbmp); - oldcolor = SetBkColor(hdcMem, white); - StretchBlt(hdcMem2,0,0,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCCOPY); - - SetBkColor(hdcMem, oldcolor); - - StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCINVERT); - StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem2,0,0,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCAND); - StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCINVERT); - if (dlog_draw == FALSE) - SetViewportOrgEx(destDC,0,0,NULL); - DeleteDC(hdcMem2); - - DeleteObject(transbmp); - - - } - } - if (dlog_draw == TRUE) - DeleteDC(hdcMem); - else SelectObject(hdcMem,store); -} - - void fry_dc(HWND hwnd,HDC dc) - { - if (ReleaseDC(hwnd,dc) == 0) - PostQuitMessage(0); - } - -void DisposeGWorld(HBITMAP bitmap) -{ - DeleteObject(bitmap); -} - -void SectRect(RECT *a, RECT *b, RECT *c) - { - IntersectRect(c,a,b); - } - -Boolean Button() -{ - MSG msg; - - if (PeekMessage(&msg,mainPtr,WM_MOUSEFIRST,WM_MOUSELAST,PM_REMOVE) > 0) - if ((msg.message == WM_LBUTTONDOWN) || (msg.message == WM_CHAR) - || (msg.message == WM_KEYDOWN)) - return TRUE; - if (PeekMessage(&msg,mainPtr,WM_KEYFIRST,WM_KEYLAST,PM_REMOVE) > 0) - if ((msg.message == WM_LBUTTONDOWN) || (msg.message == WM_CHAR) - || (msg.message == WM_KEYDOWN)) - return TRUE; - return FALSE; -} - - -// which_mode is 0 ... dest is a bitmap -// is 1 ... ignore dest ... paint on mainPtr -// is 2 ... dest is a dialog, use the dialog pattern -// both pattern gworlds are 192 x 256 -void paint_pattern(HBITMAP dest,short which_mode,RECT dest_rect,short which_pattern) -{ - HBITMAP source_pat; - RECT pattern_source = {32,168,96,232}, pat_dest_orig = {0,0,64,64},pat_dest; - short i,j; - - RECT draw_from_orig = {0,0,192,256},draw_from,draw_to; - short store_ulx,store_uly; - - if (which_mode == 1) - OffsetRect(&dest_rect,ulx, uly); - else if (which_mode == 3) - which_mode = 1; - if (which_mode == 2) { - source_pat = dialog_pattern_gworld; - if (dlog_pat_placed == 0) { - dlog_pat_placed = 1; - OffsetRect(&pattern_source, 64 * 2,0); - for (i = 0; i < 3; i++) - for (j = 0; j < 4; j++) { - pat_dest = pat_dest_orig; - OffsetRect(&pat_dest,64 * i, 64 * j); - rect_draw_some_item(mixed_gworld,pattern_source, - dialog_pattern_gworld,pat_dest,0,0); - } - } - } - else { - source_pat = pattern_gworld; - if (current_pattern != which_pattern) { - current_pattern = which_pattern; - OffsetRect(&pattern_source, 64 * (which_pattern % 5), - 64 * (which_pattern / 5)); - for (i = 0; i < 3; i++) - for (j = 0; j < 4; j++) { - pat_dest = pat_dest_orig; - OffsetRect(&pat_dest,64 * i, 64 * j); - rect_draw_some_item(mixed_gworld,pattern_source, - pattern_gworld,pat_dest,0,0); - } - } - } - - // now patterns are loaded, so have fun - // first nullify ul shifting - store_ulx = ulx; - store_uly = uly; - ulx = uly = 0; - for (i = 0; i < (dest_rect.right / 192) + 1; i++) - for (j = 0; j < (dest_rect.bottom / 256) + 1; j++) { - draw_to = draw_from_orig; - OffsetRect(&draw_to,192 * i, 256 * j); - IntersectRect(&draw_to,&draw_to,&dest_rect); - if (draw_to.right != 0) { - draw_from = draw_to; - OffsetRect(&draw_from, -192 * i, -256 * j); - switch (which_mode) { - case 0: - rect_draw_some_item(source_pat,draw_from, - dest,draw_to,0,0); break; - case 1: - rect_draw_some_item(source_pat,draw_from, - source_pat,draw_to,0,1); break; - case 2: - rect_draw_some_item(source_pat,draw_from, - dest,draw_to,0,2); break; - } - } - } - ulx = store_ulx; - uly = store_uly; -} - -/* GK */ - -HBITMAP ReadBMP(char * fileName) -{ - return (HBITMAP) LoadImage(0, fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); -} diff --git a/Win32/Blades of Exile Char Editor/GRAPHUTL.H b/Win32/Blades of Exile Char Editor/GRAPHUTL.H deleted file mode 100644 index 7222672c..00000000 --- a/Win32/Blades of Exile Char Editor/GRAPHUTL.H +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _GRAPHUTL_H - #define _GRAPHUTL_H - -HBITMAP load_pict(short pict_num,HDC model_hdc); -void rect_draw_some_item(HBITMAP src,RECT src_rect,HBITMAP dest,RECT dest_rect, - short trans, short main_win) ; - void fry_dc(HWND hwnd,HDC dc) ; - void DisposeGWorld(HBITMAP bitmap); -void SectRect(RECT *a, RECT *b, RECT *c); -Boolean Button(); -void paint_pattern(HBITMAP dest,short which_mode,RECT dest_rect,short which_pattern); - -/* GK */ -HBITMAP ReadBMP(char * fileName); - -#endif diff --git a/Win32/Blades of Exile Char Editor/Resources/SND0.WAV b/Win32/Blades of Exile Char Editor/Resources/SND0.WAV deleted file mode 100644 index 793c0297..00000000 Binary files a/Win32/Blades of Exile Char Editor/Resources/SND0.WAV and /dev/null differ diff --git a/Win32/Blades of Exile Char Editor/Resources/SND1.WAV b/Win32/Blades of Exile Char Editor/Resources/SND1.WAV deleted file mode 100644 index d057572a..00000000 Binary files a/Win32/Blades of Exile Char Editor/Resources/SND1.WAV and /dev/null differ diff --git a/Win32/Blades of Exile Char Editor/Resources/SND3.WAV b/Win32/Blades of Exile Char Editor/Resources/SND3.WAV deleted file mode 100644 index ce6b09d0..00000000 Binary files a/Win32/Blades of Exile Char Editor/Resources/SND3.WAV and /dev/null differ diff --git a/Win32/Blades of Exile Char Editor/Resources/SND34.WAV b/Win32/Blades of Exile Char Editor/Resources/SND34.WAV deleted file mode 100644 index 0a40f8d7..00000000 Binary files a/Win32/Blades of Exile Char Editor/Resources/SND34.WAV and /dev/null differ diff --git a/Win32/Blades of Exile Char Editor/Resources/SND37.WAV b/Win32/Blades of Exile Char Editor/Resources/SND37.WAV deleted file mode 100644 index 6781ba20..00000000 Binary files a/Win32/Blades of Exile Char Editor/Resources/SND37.WAV and /dev/null differ diff --git a/Win32/Blades of Exile/Blades of Exile.cbp b/Win32/Blades of Exile/Blades of Exile.cbp index dc60a9ff..d51a266a 100644 --- a/Win32/Blades of Exile/Blades of Exile.cbp +++ b/Win32/Blades of Exile/Blades of Exile.cbp @@ -44,10 +44,6 @@ - - - - @@ -85,15 +81,19 @@ - - - - - - + + + + + + + + + + diff --git a/Win32/Blades of Exile/Blades of Exile.dev b/Win32/Blades of Exile/Blades of Exile.dev index 84ea7e17..a3929f30 100644 --- a/Win32/Blades of Exile/Blades of Exile.dev +++ b/Win32/Blades of Exile/Blades of Exile.dev @@ -93,27 +93,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit7] -FileName=GLOBAL.CPP -CompileCpp=1 -Folder=Blades of Exile -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - [Unit8] -FileName=boe.graphics.cpp -CompileCpp=1 -Folder=Blades of Exile -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit9] FileName=boe.graphutil.cpp CompileCpp=1 Folder=Blades of Exile @@ -123,7 +103,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit10] +[Unit9] FileName=boe.infodlg.cpp CompileCpp=1 Folder=Blades of Exile @@ -133,7 +113,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit11] +[Unit10] FileName=boe.itemdata.cpp CompileCpp=1 Folder=Blades of Exile @@ -143,8 +123,8 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit13] -FileName=boe.locutils.cpp +[Unit11] +FileName=boe.items.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -153,7 +133,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit14] +[Unit13] FileName=boe.monster.cpp CompileCpp=1 Folder=Blades of Exile @@ -163,7 +143,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit15] +[Unit14] FileName=boe.newgraph.cpp CompileCpp=1 Folder=Blades of Exile @@ -173,7 +153,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit16] +[Unit15] FileName=boe.party.cpp CompileCpp=1 Folder=Blades of Exile @@ -183,7 +163,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit17] +[Unit16] FileName=boe.specials.cpp CompileCpp=1 Folder=Blades of Exile @@ -193,7 +173,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit18] +[Unit17] FileName=boe.text.cpp CompileCpp=1 Folder=Blades of Exile @@ -203,7 +183,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit19] +[Unit18] FileName=boe.town.cpp CompileCpp=1 Folder=Blades of Exile @@ -213,7 +193,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit20] +[Unit19] FileName=BLADES.RC CompileCpp=1 Folder=Blades of Exile @@ -223,8 +203,8 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit22] -FileName=GAMESTR.RC +[Unit20] +FileName=GAMEDLOG.RC CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -233,8 +213,18 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= +[Unit22] +FileName=boe.actions.h +CompileCpp=1 +Folder=Blades of Exile +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + [Unit24] -FileName=boe.combat.h +FileName=boe.dlgutil.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -264,26 +254,6 @@ AutoIncBuildNrOnCompile=0 AutoIncBuildNr=0 [Unit26] -FileName=boe.fields.h -Folder=Blades of Exile -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= -CompileCpp=1 - -[Unit25] -FileName=boe.dlgutil.h -Folder=Blades of Exile -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= -CompileCpp=1 - -[Unit27] FileName=boe.fileio.h Folder=Blades of Exile Compile=1 @@ -293,27 +263,17 @@ OverrideBuildCmd=0 BuildCmd= CompileCpp=1 +[Unit25] +FileName=boe.fields.h +Folder=Blades of Exile +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + [Unit28] -FileName=GLOBAL.H -CompileCpp=1 -Folder=Blades of Exile -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit29] -FileName=boe.graphics.h -CompileCpp=1 -Folder=Blades of Exile -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit30] FileName=boe.graphutil.h CompileCpp=1 Folder=Blades of Exile @@ -323,27 +283,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit31] -FileName=GLOBVAR.H -CompileCpp=1 -Folder= -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit32] -FileName=boe.infodlg.h -CompileCpp=1 -Folder=Blades of Exile -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit33] +[Unit30] FileName=boe.itemdata.h CompileCpp=1 Folder=Blades of Exile @@ -353,7 +293,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit34] +[Unit31] FileName=boe.items.h CompileCpp=1 Folder=Blades of Exile @@ -363,7 +303,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit35] +[Unit32] FileName=boe.locutils.h CompileCpp=1 Folder=Blades of Exile @@ -373,7 +313,17 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit37] +[Unit33] +FileName=boe.monster.h +CompileCpp=1 +Folder=Blades of Exile +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit34] FileName=boe.newgraph.h CompileCpp=1 Folder=Blades of Exile @@ -383,7 +333,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit38] +[Unit35] FileName=boe.party.h CompileCpp=1 Folder=Blades of Exile @@ -393,17 +343,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit39] -FileName=boe.specials.h -CompileCpp=1 -Folder=Blades of Exile -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit40] +[Unit37] FileName=boe.text.h CompileCpp=1 Folder=Blades of Exile @@ -413,7 +353,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit41] +[Unit38] FileName=boe.town.h CompileCpp=1 Folder=Blades of Exile @@ -423,7 +363,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit42] +[Unit39] FileName=boe.main.h CompileCpp=1 Folder= @@ -433,7 +373,17 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit46] +[Unit40] +FileName=classes\consts.h +CompileCpp=1 +Folder=Classes +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit42] FileName=tools\soundtool.h CompileCpp=1 Folder=Tools @@ -443,27 +393,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit50] -FileName=tools\mathutil.cpp -CompileCpp=1 -Folder=Tools -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit51] -FileName=tools\mathutil.h -CompileCpp=1 -Folder=Tools -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit52] +[Unit46] FileName=classes\item.cpp CompileCpp=1 Folder=Classes @@ -473,8 +403,38 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= +[Unit50] +FileName=global.h +CompileCpp=1 +Folder=Blades of Exile Win32 +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit51] +FileName=globvar.cpp +CompileCpp=1 +Folder=Blades of Exile Win32 +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit52] +FileName=tools\dlogtool.h +CompileCpp=1 +Folder=Tools +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + [Unit55] -FileName=classes\LOCATION.H +FileName=classes\location.cpp CompileCpp=1 Folder=Classes Compile=1 @@ -484,7 +444,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit56] -FileName=classes\PC.CPP +FileName=classes\location.h CompileCpp=1 Folder=Classes Compile=1 @@ -494,9 +454,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit43] -FileName=GLOBVAR.CPP +FileName=tools\soundvars.cpp CompileCpp=1 -Folder= +Folder=Tools Compile=1 Link=1 Priority=1000 @@ -532,9 +492,9 @@ CompilerSet=0 compilerType=0 [Unit53] -FileName=classes\item.h +FileName=tools\dlogtool.cpp CompileCpp=1 -Folder=Classes +Folder=Tools Compile=1 Link=1 Priority=1000 @@ -542,7 +502,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit54] -FileName=classes\LOCATION.CPP +FileName=classes\pc.h CompileCpp=1 Folder=Classes Compile=1 @@ -552,7 +512,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit57] -FileName=classes\PC.H +FileName=classes\pc.cpp CompileCpp=1 Folder=Classes Compile=1 @@ -582,7 +542,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit36] -FileName=boe.monster.h +FileName=boe.specials.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -592,7 +552,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit12] -FileName=boe.items.cpp +FileName=boe.locutils.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -602,7 +562,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit21] -FileName=GAMEDLOG.RC +FileName=GAMESTR.RC CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -612,7 +572,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit23] -FileName=boe.actions.h +FileName=boe.combat.h Folder=Blades of Exile Compile=1 Link=1 @@ -621,8 +581,18 @@ OverrideBuildCmd=0 BuildCmd= CompileCpp=1 -[Unit44] -FileName=classes\consts.h +[Unit49] +FileName=global.cpp +CompileCpp=1 +Folder=Blades of Exile Win32 +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit47] +FileName=classes\item.h CompileCpp=1 Folder=Classes Compile=1 @@ -631,37 +601,47 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit48] -FileName=tools\DLOGTOOL.CPP -CompileCpp=1 -Folder=Tools -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit49] -FileName=tools\DLOGTOOL.H -CompileCpp=1 -Folder=Tools -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit47] -FileName=tools\soundvars.cpp -CompileCpp=1 -Folder=Tools -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - [Unit45] +FileName=tools\mathutil.h +CompileCpp=1 +Folder=Tools +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=boe.graphics.cpp +CompileCpp=1 +Folder=Blades of Exile +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit27] +FileName=boe.graphics.h +CompileCpp=1 +Folder=Blades of Exile +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit29] +FileName=boe.infodlg.h +CompileCpp=1 +Folder=Blades of Exile +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit41] FileName=tools\soundtool.cpp CompileCpp=1 Folder=Tools @@ -671,3 +651,23 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= +[Unit44] +FileName=tools\mathutil.cpp +CompileCpp=1 +Folder=Tools +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit48] +FileName=globvar.h +CompileCpp=1 +Folder=Blades of Exile Win32 +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/Win32/Blades of Exile/GAMEDLOG.RC b/Win32/Blades of Exile/GAMEDLOG.RC index fedcab82..04e0acd5 100644 --- a/Win32/Blades of Exile/GAMEDLOG.RC +++ b/Win32/Blades of Exile/GAMEDLOG.RC @@ -151,7 +151,7 @@ STYLE WS_POPUP | WS_DLGFRAME STYLE WS_POPUP | WS_DLGFRAME { } - + 901 DIALOG 10, 10, 338, 113 STYLE WS_POPUP | WS_DLGFRAME { @@ -1168,7 +1168,7 @@ STYLE WS_POPUP | WS_DLGFRAME { LTEXT "1_63", 1, 435, 295, 61, 20 LTEXT "5_716", 2, 6, 6, 36, 36 - LTEXT "Classic Blades of Exile version 1.1 | Copyright 1997, Spiderweb Software, Inc., All rights reserved.||Blades of Exile is distributed for free under GNU General Public License version 2.", 3, 50, 6, 420, 33 + LTEXT "Classic Blades of Exile build_26.05.2010 | Copyright 1997, Spiderweb Software, Inc., All rights reserved.||Blades of Exile is distributed for free under GNU General Public License version 2.", 3, 50, 6, 420, 33 LTEXT "CONTRIBUTORS : Ormus, Ishad Nha, Celtic Minstrel, Niemand and all involved in the BoE community.", 4, 50, 227, 424, 33 LTEXT "Comments? Questions? Bugs? Post them at the Blades section of the Irony Central Board: www.ironycentral.com/forum/", 5, 50, 271, 354, 32 LTEXT "Blades of Exile was brought to you by Spiderweb Software - | _Where our aberrations become your reality._ |_Blades of Exile_ and Spiderweb Software are trademarks of Spiderweb Software.", 7, 50, 154, 410, 51 @@ -1643,9 +1643,9 @@ STYLE WS_POPUP | WS_DLGFRAME LTEXT "Display Grass and Moutains Trims", 12, 70 ,122 ,182 ,17 LTEXT "2_0", 13, 49, 126, 17, 18 LTEXT "Specials Interrupt Waiting/Rest", 14, 70 ,142 ,182 ,17 - LTEXT "2_0", 15, 49, 146, 17, 18 + LTEXT "2_0", 15, 49, 146, 17, 18 LTEXT "Stairway Nodes can be called anytime", 16, 70 ,162 ,182 ,17 - LTEXT "2_0", 17, 49, 166, 17, 18 + LTEXT "2_0", 17, 49, 166, 17, 18 LTEXT "Special Timers are checked when resting outdoor/in inn", 18, 70 ,182 ,182 ,17 - LTEXT "2_0", 19, 49, 186, 17, 18 + LTEXT "2_0", 19, 49, 186, 17, 18 } diff --git a/Win32/Blades of Exile/Makefile-DevCpp.win b/Win32/Blades of Exile/Makefile-DevCpp.win index 2de620a1..148582bf 100644 --- a/Win32/Blades of Exile/Makefile-DevCpp.win +++ b/Win32/Blades of Exile/Makefile-DevCpp.win @@ -5,8 +5,8 @@ CPP = g++.exe CC = gcc.exe WINDRES = windres.exe RES = Blades_of_Exile_private.res -OBJ = boe.actions.o boe.main.o boe.combat.o boe.dlgutil.o boe.fields.o boe.fileio.o GLOBAL.o boe.graphics.o boe.graphutil.o boe.infodlg.o boe.itemdata.o boe.items.o boe.locutils.o boe.monster.o boe.newgraph.o boe.party.o boe.specials.o boe.text.o boe.town.o GLOBVAR.o tools/soundtool.o tools/soundvars.o tools/DLOGTOOL.o tools/mathutil.o classes/item.o classes/LOCATION.o classes/PC.o $(RES) -LINKOBJ = boe.actions.o boe.main.o boe.combat.o boe.dlgutil.o boe.fields.o boe.fileio.o GLOBAL.o boe.graphics.o boe.graphutil.o boe.infodlg.o boe.itemdata.o boe.items.o boe.locutils.o boe.monster.o boe.newgraph.o boe.party.o boe.specials.o boe.text.o boe.town.o GLOBVAR.o tools/soundtool.o tools/soundvars.o tools/DLOGTOOL.o tools/mathutil.o classes/item.o classes/LOCATION.o classes/PC.o $(RES) +OBJ = boe.actions.o boe.main.o boe.combat.o boe.dlgutil.o boe.fields.o boe.fileio.o global.o boe.graphics.o boe.graphutil.o boe.infodlg.o boe.itemdata.o boe.items.o boe.locutils.o boe.monster.o boe.newgraph.o boe.party.o boe.specials.o boe.text.o boe.town.o globvar.o tools/soundtool.o tools/soundvars.o tools/dlogtool.o tools/mathutil.o classes/item.o classes/location.o classes/pc.o $(RES) +LINKOBJ = boe.actions.o boe.main.o boe.combat.o boe.dlgutil.o boe.fields.o boe.fileio.o global.o boe.graphics.o boe.graphutil.o boe.infodlg.o boe.itemdata.o boe.items.o boe.locutils.o boe.monster.o boe.newgraph.o boe.party.o boe.specials.o boe.text.o boe.town.o globvar.o tools/soundtool.o tools/soundvars.o tools/dlogtool.o tools/mathutil.o classes/item.o classes/location.o classes/pc.o $(RES) LIBS = -mwindows -lwinmm INCS = -I"include" CXXINCS = @@ -44,8 +44,8 @@ boe.fields.o: boe.fields.cpp boe.fileio.o: boe.fileio.cpp $(CPP) -c boe.fileio.cpp -o boe.fileio.o $(CXXFLAGS) -GLOBAL.o: GLOBAL.CPP - $(CPP) -c GLOBAL.CPP -o GLOBAL.o $(CXXFLAGS) +global.o: global.cpp + $(CPP) -c global.cpp -o global.o $(CXXFLAGS) boe.graphics.o: boe.graphics.cpp $(CPP) -c boe.graphics.cpp -o boe.graphics.o $(CXXFLAGS) @@ -83,8 +83,8 @@ boe.text.o: boe.text.cpp boe.town.o: boe.town.cpp $(CPP) -c boe.town.cpp -o boe.town.o $(CXXFLAGS) -GLOBVAR.o: GLOBVAR.CPP - $(CPP) -c GLOBVAR.CPP -o GLOBVAR.o $(CXXFLAGS) +globvar.o: globvar.cpp + $(CPP) -c globvar.cpp -o globvar.o $(CXXFLAGS) tools/soundtool.o: tools/soundtool.cpp $(CPP) -c tools/soundtool.cpp -o tools/soundtool.o $(CXXFLAGS) @@ -92,8 +92,8 @@ tools/soundtool.o: tools/soundtool.cpp tools/soundvars.o: tools/soundvars.cpp $(CPP) -c tools/soundvars.cpp -o tools/soundvars.o $(CXXFLAGS) -tools/DLOGTOOL.o: tools/DLOGTOOL.CPP - $(CPP) -c tools/DLOGTOOL.CPP -o tools/DLOGTOOL.o $(CXXFLAGS) +tools/dlogtool.o: tools/dlogtool.cpp + $(CPP) -c tools/dlogtool.cpp -o tools/dlogtool.o $(CXXFLAGS) tools/mathutil.o: tools/mathutil.cpp $(CPP) -c tools/mathutil.cpp -o tools/mathutil.o $(CXXFLAGS) @@ -101,11 +101,11 @@ tools/mathutil.o: tools/mathutil.cpp classes/item.o: classes/item.cpp $(CPP) -c classes/item.cpp -o classes/item.o $(CXXFLAGS) -classes/LOCATION.o: classes/LOCATION.CPP - $(CPP) -c classes/LOCATION.CPP -o classes/LOCATION.o $(CXXFLAGS) +classes/location.o: classes/location.cpp + $(CPP) -c classes/location.cpp -o classes/location.o $(CXXFLAGS) -classes/PC.o: classes/PC.CPP - $(CPP) -c classes/PC.CPP -o classes/PC.o $(CXXFLAGS) +classes/pc.o: classes/pc.cpp + $(CPP) -c classes/pc.cpp -o classes/pc.o $(CXXFLAGS) Blades_of_Exile_private.res: Blades_of_Exile_private.rc BLADES.RC GAMEDLOG.RC GAMESTR.RC $(WINDRES) -i Blades_of_Exile_private.rc --input-format=rc -o Blades_of_Exile_private.res -O coff -D_INCLUDED_RC diff --git a/Win32/Blades of Exile/Resources/BOOT.CUR b/Win32/Blades of Exile/Resources/BOOT.CUR deleted file mode 100644 index 0bb41768..00000000 Binary files a/Win32/Blades of Exile/Resources/BOOT.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/C.CUR b/Win32/Blades of Exile/Resources/C.CUR deleted file mode 100644 index bcc4fefc..00000000 Binary files a/Win32/Blades of Exile/Resources/C.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/D.CUR b/Win32/Blades of Exile/Resources/D.CUR deleted file mode 100644 index 68617d3e..00000000 Binary files a/Win32/Blades of Exile/Resources/D.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/DL.CUR b/Win32/Blades of Exile/Resources/DL.CUR deleted file mode 100644 index c4861293..00000000 Binary files a/Win32/Blades of Exile/Resources/DL.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/DR.CUR b/Win32/Blades of Exile/Resources/DR.CUR deleted file mode 100644 index 7c1ae737..00000000 Binary files a/Win32/Blades of Exile/Resources/DR.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/KEY.CUR b/Win32/Blades of Exile/Resources/KEY.CUR deleted file mode 100644 index 3cdf2d4a..00000000 Binary files a/Win32/Blades of Exile/Resources/KEY.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/L.CUR b/Win32/Blades of Exile/Resources/L.CUR deleted file mode 100644 index be7af994..00000000 Binary files a/Win32/Blades of Exile/Resources/L.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/LOOK.CUR b/Win32/Blades of Exile/Resources/LOOK.CUR deleted file mode 100644 index ca1ad8e5..00000000 Binary files a/Win32/Blades of Exile/Resources/LOOK.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/R.CUR b/Win32/Blades of Exile/Resources/R.CUR deleted file mode 100644 index 39f194ec..00000000 Binary files a/Win32/Blades of Exile/Resources/R.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/SWORD.CUR b/Win32/Blades of Exile/Resources/SWORD.CUR deleted file mode 100644 index 938203a3..00000000 Binary files a/Win32/Blades of Exile/Resources/SWORD.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/TALK.CUR b/Win32/Blades of Exile/Resources/TALK.CUR deleted file mode 100644 index 2d0fe3e6..00000000 Binary files a/Win32/Blades of Exile/Resources/TALK.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/TARGET.CUR b/Win32/Blades of Exile/Resources/TARGET.CUR deleted file mode 100644 index a077508f..00000000 Binary files a/Win32/Blades of Exile/Resources/TARGET.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/U.CUR b/Win32/Blades of Exile/Resources/U.CUR deleted file mode 100644 index 56ef1d9c..00000000 Binary files a/Win32/Blades of Exile/Resources/U.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/UL.CUR b/Win32/Blades of Exile/Resources/UL.CUR deleted file mode 100644 index 9ffadb99..00000000 Binary files a/Win32/Blades of Exile/Resources/UL.CUR and /dev/null differ diff --git a/Win32/Blades of Exile/Resources/UR.CUR b/Win32/Blades of Exile/Resources/UR.CUR deleted file mode 100644 index 113bd7a3..00000000 Binary files a/Win32/Blades of Exile/Resources/UR.CUR and /dev/null differ diff --git a/Win32/Blades of Exile Char Editor/Resources/BOOT.CUR b/Win32/Blades of Exile/Resources/boot.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/BOOT.CUR rename to Win32/Blades of Exile/Resources/boot.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/C.CUR b/Win32/Blades of Exile/Resources/c.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/C.CUR rename to Win32/Blades of Exile/Resources/c.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/D.CUR b/Win32/Blades of Exile/Resources/d.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/D.CUR rename to Win32/Blades of Exile/Resources/d.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/DL.CUR b/Win32/Blades of Exile/Resources/dl.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/DL.CUR rename to Win32/Blades of Exile/Resources/dl.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/DR.CUR b/Win32/Blades of Exile/Resources/dr.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/DR.CUR rename to Win32/Blades of Exile/Resources/dr.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/KEY.CUR b/Win32/Blades of Exile/Resources/key.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/KEY.CUR rename to Win32/Blades of Exile/Resources/key.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/L.CUR b/Win32/Blades of Exile/Resources/l.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/L.CUR rename to Win32/Blades of Exile/Resources/l.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/LOOK.CUR b/Win32/Blades of Exile/Resources/look.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/LOOK.CUR rename to Win32/Blades of Exile/Resources/look.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/R.CUR b/Win32/Blades of Exile/Resources/r.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/R.CUR rename to Win32/Blades of Exile/Resources/r.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/SWORD.CUR b/Win32/Blades of Exile/Resources/sword.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/SWORD.CUR rename to Win32/Blades of Exile/Resources/sword.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/TALK.CUR b/Win32/Blades of Exile/Resources/talk.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/TALK.CUR rename to Win32/Blades of Exile/Resources/talk.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/TARGET.CUR b/Win32/Blades of Exile/Resources/target.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/TARGET.CUR rename to Win32/Blades of Exile/Resources/target.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/U.CUR b/Win32/Blades of Exile/Resources/u.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/U.CUR rename to Win32/Blades of Exile/Resources/u.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/UL.CUR b/Win32/Blades of Exile/Resources/ul.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/UL.CUR rename to Win32/Blades of Exile/Resources/ul.cur diff --git a/Win32/Blades of Exile Char Editor/Resources/UR.CUR b/Win32/Blades of Exile/Resources/ur.cur similarity index 100% rename from Win32/Blades of Exile Char Editor/Resources/UR.CUR rename to Win32/Blades of Exile/Resources/ur.cur diff --git a/Win32/Blades of Exile/boe.combat.cpp b/Win32/Blades of Exile/boe.combat.cpp index b76a8685..5f3f092e 100644 --- a/Win32/Blades of Exile/boe.combat.cpp +++ b/Win32/Blades of Exile/boe.combat.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "global.h" #include "boe.monster.h" diff --git a/Win32/Blades of Exile/boe.dlgutil.cpp b/Win32/Blades of Exile/boe.dlgutil.cpp index 7d00af0d..9d862375 100644 --- a/Win32/Blades of Exile/boe.dlgutil.cpp +++ b/Win32/Blades of Exile/boe.dlgutil.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "global.h" #include "boe.dlgutil.h" @@ -41,10 +41,10 @@ shop_type: void start_shop_mode(short shop_type,short shop_min,short shop_max,short cost_adj,char *store_name) { RECT area_rect; - + if(PSD[307][1] == 1) ShowWindow(talk_edit_box, SW_HIDE); - + if (shop_max < shop_min) shop_max = shop_min; //// store_cost_mult = cost_adj; @@ -53,24 +53,24 @@ void start_shop_mode(short shop_type,short shop_min,short shop_max,short cost_ad store_shop_type = shop_type; store_shop_min = shop_min; store_shop_max = shop_max; - + area_rect = talk_area_rect; strcpy((char *) store_store_name,store_name); OffsetRect(&area_rect, -1 * area_rect.left,-1 * area_rect.top); if (talk_gworld == NULL) talk_gworld = CreateCompatibleBitmap(main_dc,area_rect.right,area_rect.bottom); - + store_pre_shop_mode = overall_mode; overall_mode = 21; stat_screen_mode = 1; create_clip_region(); - + set_up_shop_array(); put_background(); - + draw_shop_graphics(0,area_rect); - + put_item_screen(stat_window,0); give_help(26,27,0); } @@ -78,10 +78,10 @@ void start_shop_mode(short shop_type,short shop_min,short shop_max,short cost_ad void end_shop_mode() { RECT dummy_rect = {0,0,0,0}; - + if(PSD[307][1] == 1) ShowWindow(talk_edit_box, SW_SHOW); - + ShowScrollBar(shop_sbar,SB_CTL,FALSE); if (store_pre_shop_mode == 20) { sprintf((char *)old_str1,"You conclude your business."); @@ -96,7 +96,7 @@ void end_shop_mode() DeleteObject(talk_gworld); talk_gworld = NULL; } - + overall_mode = store_pre_shop_mode; create_clip_region(); if (overall_mode == MODE_TALK_TOWN) @@ -151,7 +151,7 @@ void handle_sale(short what_chosen,short cost) RECT dummy_rect = {0,0,0,0}; switch (what_chosen / 100) { - case 0: case 1: case 2: case 3: case 4: + case 0: case 1: case 2: case 3: case 4: base_item = get_stored_item(what_chosen); base_item.item_properties = base_item.item_properties | 1; //cost = (base_item.charges == 0) ? base_item.value : base_item.value * base_item.charges; @@ -193,9 +193,9 @@ void handle_sale(short what_chosen,short cost) adven[current_pc].status[7] = 0; break; case 3: adven[current_pc].status[12] = 0; break; - case 4: + case 4: for (i = 0; i < 24; i++) - if ((adven[current_pc].equip[i] == TRUE) && + if ((adven[current_pc].equip[i] == TRUE) && (adven[current_pc].items[i].isCursed())) adven[current_pc].items[i].item_properties = adven[current_pc].items[i].item_properties & 239; @@ -243,7 +243,7 @@ void handle_sale(short what_chosen,short cost) base_item = party.magic_store_items[what_magic_shop][what_magic_shop_item]; base_item.item_properties = base_item.item_properties | 1; switch (adven[current_pc].okToBuy(cost,base_item)) { - case 1: play_sound(-38); adven[current_pc].giveToPC(base_item,true); + case 1: play_sound(-38); adven[current_pc].giveToPC(base_item,true); party.magic_store_items[what_magic_shop][what_magic_shop_item].variety = 0; break; case 2: ASB("Can't carry any more items."); break; @@ -253,11 +253,11 @@ void handle_sale(short what_chosen,short cost) break; } set_up_shop_array(); - + if (overall_mode != 21) { MessageBeep(MB_OK); ASB("Shop error 1. Report This!"); - } + } draw_shop_graphics(0,dummy_rect); print_buf(); put_pc_screen(); @@ -269,9 +269,9 @@ void handle_info_request(short what_chosen) { item_record_type base_item; short what_magic_shop,what_magic_shop_item; - + switch (what_chosen / 100) { - case 0: case 1: case 2: case 3: case 4: + case 0: case 1: case 2: case 3: case 4: base_item = get_stored_item(what_chosen); base_item.item_properties = base_item.item_properties | 1; display_pc_item(6,0, base_item,0); @@ -303,7 +303,7 @@ void set_up_shop_array() Boolean cursed_item = FALSE; item_record_type store_i; long store_l; - + for (i = 0; i < 30; i++) store_shop_items[i] = -1; switch (store_shop_type) { @@ -311,11 +311,11 @@ void set_up_shop_array() for (i = store_shop_min; i < store_shop_max + 1; i++) { store_shop_items[shop_pos] = i; store_i = get_stored_item(store_shop_items[shop_pos]); - store_shop_costs[shop_pos] = (store_i.charges == 0) ? + store_shop_costs[shop_pos] = (store_i.charges == 0) ? store_i.value : store_i.value * store_i.charges; shop_pos++; } - break; + break; case 3: if (adven[current_pc].cur_health < adven[current_pc].max_health) { store_shop_items[shop_pos] = 700; @@ -373,13 +373,13 @@ void set_up_shop_array() if (party.magic_store_items[store_shop_type - 5][i].variety != 0) { store_shop_items[shop_pos] = (store_shop_type - 4) * 1000 + i; store_i = party.magic_store_items[store_shop_type - 5][i]; - store_shop_costs[shop_pos] = (store_i.charges == 0) ? + store_shop_costs[shop_pos] = (store_i.charges == 0) ? store_i.value : store_i.value * store_i.charges; shop_pos++; } break; case 10: - for (i = store_shop_min; i < store_shop_max + 1; i++) + for (i = store_shop_min; i < store_shop_max + 1; i++) if (i == minmax(0,31,(int)i)) { store_i = store_mage_spells(i); store_shop_costs[shop_pos] = store_i.value; @@ -388,7 +388,7 @@ void set_up_shop_array() } break; case 11: - for (i = store_shop_min; i < store_shop_max + 1; i++) + for (i = store_shop_min; i < store_shop_max + 1; i++) if (i == minmax(0,31,(int)i)) { store_i = store_priest_spells(i); store_shop_costs[shop_pos] = store_i.value; @@ -397,7 +397,7 @@ void set_up_shop_array() } break; case 12: - for (i = store_shop_min; i < store_shop_max + 1; i++) + for (i = store_shop_min; i < store_shop_max + 1; i++) if (i == minmax(0,19,(int)i)) { store_i = store_alchemy(i); store_shop_costs[shop_pos] = store_i.value; @@ -427,7 +427,7 @@ void start_talk_mode(short m_num,short personality,unsigned char monst_type,shor char place_string2[256] = ""; store_personality = personality; - + store_monst_type = monst_type; store_m_num = m_num; store_talk_face_pic = store_face_pic; //// @@ -446,7 +446,7 @@ void start_talk_mode(short m_num,short personality,unsigned char monst_type,shor store_edit_parent = mainPtr; old_edit_proc = (WNDPROC) (GetWindowLong(talk_edit_box,GWL_WNDPROC)); SetWindowLong(talk_edit_box,GWL_WNDPROC,(LONG) edit_proc); - SetFocus(talk_edit_box); + SetFocus(talk_edit_box); } // first make sure relevant talk strs are loaded in @@ -455,13 +455,13 @@ void start_talk_mode(short m_num,short personality,unsigned char monst_type,shor // Dredge up critter's name sprintf((char *) title_string,"%s:",data_store3->talk_strs[personality % 10]); - + store_pre_talk_mode = overall_mode; overall_mode = 20; create_clip_region(); talk_end_forced = FALSE; stat_screen_mode = 1; - + // Bring up and place first strings. sprintf((char *) place_string1,"%s",data_store3->talk_strs[personality % 10 + 10]); strnum1 = personality % 10 + 10; @@ -471,7 +471,7 @@ void start_talk_mode(short m_num,short personality,unsigned char monst_type,shor strcpy((char *) one_back1,(char *) place_string1); strcpy((char *) one_back2,(char *) place_string2); place_talk_str((char *) place_string1,(char *) place_string2,0,dummy_rect); - + put_item_screen(stat_window,0); give_help(5,6,0); @@ -486,7 +486,7 @@ void end_talk_mode() DestroyWindow(talk_edit_box); talk_edit_box = NULL; } - + overall_mode = store_pre_talk_mode; create_clip_region(); @@ -496,14 +496,14 @@ void end_talk_mode() center = c_town.p_loc; update_explored(center); } - + stat_screen_mode = 0; - + put_item_screen(stat_window,0); put_pc_screen(); redraw_screen(0); - - + + } void handle_talk_event(POINT p) @@ -541,7 +541,7 @@ void handle_talk_event(POINT p) return; } for (j = 0; j < 120; j++) - if ((party.talk_save[j].personality == store_personality) && + if ((party.talk_save[j].personality == store_personality) && (party.talk_save[j].str1 == strnum1) && (party.talk_save[j].str2 == strnum2)) { ASB("This is already saved."); @@ -558,12 +558,12 @@ void handle_talk_event(POINT p) party.talk_save[j].str2 = strnum2; ASB("Noted in journal."); j = 200; - } + } if (j < 200) { MessageBeep(MB_OK); ASB("No more room in talking journal."); - } - print_buf(); + } + print_buf(); return; break; case 6: // quit @@ -578,34 +578,34 @@ void handle_talk_event(POINT p) j = 900; adven.disease(2); } - // Plants and magic shops + // Plants and magic shops if (party.age % 4000 == 0) refresh_store_items(); - + timed_special_happened = special_increase_age(0); - + if(timed_special_happened && PSD[309][4] == 1){ j = 900; add_string_to_buf(" Rest interrupted."); print_buf(); } } - } + } return; break; default: for (j = 0; j < 4; j++) asked[j] = preset_words[i].word[j]; break; - } + } i = 100; } if (i < 100) { - for (i = 0; i < 50; i++) + for (i = 0; i < 50; i++) if ((PtInRect(&store_words[i].word_rect,p)) && (talk_end_forced == FALSE)) { click_talk_rect((char *) old_str1,(char *) old_str2,store_words[i].word_rect); for (j = 0; j < 4; j++) asked[j] = store_words[i].word[j]; - + i = 100; } } @@ -625,7 +625,7 @@ void handle_talk_event(POINT p) asked[2] = place_string1[2]; asked[3] = place_string1[3]; } - + if ((asked[0] == 'n') && (asked[1] == 'a') &&(asked[2] == 'm') &&(asked[3] == 'e')) { force_special = 2; } @@ -634,7 +634,7 @@ void handle_talk_event(POINT p) } if (((asked[0] == 'j') && (asked[1] == 'o') &&(asked[2] == 'b')) || ((asked[0] == 'w') && (asked[1] == 'o') &&(asked[2] == 'r')&&(asked[3] == 'k')) ) { - force_special = 3; + force_special = 3; } if((asked[0] == 'b') && (asked[1] == 'u') && (asked[2] == 'y')) force_special = 4; @@ -649,7 +649,7 @@ void handle_talk_event(POINT p) GetIndString(place_string1,120 + ((store_personality - 1) / 10), ((store_personality - 1) % 10) * 3 + 10 + force_special); sprintf((char *) place_string1,"%s",data_store3->talk_strs[store_personality % 10 + 10 * force_special]); - + oldstrnum1 = strnum1; oldstrnum2 = strnum2; strnum1 = store_personality % 10 + 10 * force_special; strnum2 = 0; @@ -695,7 +695,7 @@ void handle_talk_event(POINT p) break; } } - + which_talk_entry = scan_for_response(asked); if ((which_talk_entry < 0) || (which_talk_entry > 59)) { strcpy((char *) one_back1,(char *) old_str1); @@ -706,9 +706,9 @@ void handle_talk_event(POINT p) sprintf((char *) old_str1,"You get no response."); place_talk_str((char *) old_str1,(char *) old_str2,0,dummy_rect); strnum1 = -1; - return; + return; } - + ttype = talking.talk_nodes[which_talk_entry].type; a = talking.talk_nodes[which_talk_entry].extras[0]; b = talking.talk_nodes[which_talk_entry].extras[1]; @@ -717,7 +717,7 @@ void handle_talk_event(POINT p) sprintf((char *) place_string1,"%s",data_store3->talk_strs[40 + which_talk_entry * 2]); sprintf((char *) place_string2,"%s",data_store3->talk_strs[40 + which_talk_entry * 2 + 1]); - + oldstrnum1 = strnum1; oldstrnum2 = strnum2; strnum1 = 40 + which_talk_entry * 2; strnum2 = 40 + which_talk_entry * 2 + 1; @@ -729,7 +729,7 @@ void handle_talk_event(POINT p) strnum1 = strnum2; strcpy((char *) place_string1,(char *) place_string2); } - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); strnum2 = 0; break; case 2: @@ -751,7 +751,7 @@ void handle_talk_event(POINT p) c_town.p_loc.x = c; c_town.p_loc.y = d; center = c_town.p_loc; - } + } else{ adven.heal(30 * b); adven.restoreSP(25 * b); @@ -762,14 +762,14 @@ void handle_talk_event(POINT p) } } strnum2 = 0; - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); break; case 4: if (day_reached((unsigned char) a,0) == TRUE) { strnum1 = strnum2; strcpy((char *) place_string1,(char *) place_string2); } - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); strnum2 = 0; break; case 5: @@ -777,7 +777,7 @@ void handle_talk_event(POINT p) strnum1 = strnum2; strcpy((char *) place_string1,(char *) place_string2); } - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); strnum2 = 0; break; case 6: @@ -785,25 +785,25 @@ void handle_talk_event(POINT p) strnum1 = strnum2; strcpy((char *) place_string1,(char *) place_string2); } - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); strnum2 = 0; break; - case 7: + case 7: c = minmax(1,30,(int)c); start_shop_mode(2,b, b + c - 1,a,(char *)place_string1); strnum1 = -1; return; - case 8: + case 8: if ((get_pc = char_select_pc(1,0,"Train who?")) < 6) { strnum1 = -1; spend_xp(get_pc,1, 0); } - sprintf((char *) place_string1, "You conclude your training."); + sprintf((char *) place_string1, "You conclude your training."); put_pc_screen(); return; - - case 9: case 10: case 11: + + case 9: case 10: case 11: c = minmax(1,30,(int)c); start_shop_mode(ttype + 1,b, b + c - 1,a,(char *)place_string1); @@ -849,12 +849,12 @@ void handle_talk_event(POINT p) put_pc_screen(); } - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); strnum2 = 0; break; case 19: if ((sd_legit(b,c) == TRUE) && (PSD[b][c] == d)) { - sprintf((char *) place_string1, "You've already learned that."); + sprintf((char *) place_string1, "You've already learned that."); strnum1 = -1; } else if (party.gold < a) { @@ -869,14 +869,14 @@ void handle_talk_event(POINT p) else give_error("Invalid Stuff Done flag called in conversation.","",0); } strnum2 = 0; - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); break; case 20: if (party.gold < a) { strnum1 = strnum2; strnum2 = 0; strcpy((char *) place_string1,(char *) place_string2); - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); break; } else { @@ -885,15 +885,15 @@ void handle_talk_event(POINT p) party.gold -= a; put_pc_screen(); party.boats[i].property = FALSE; - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); strnum2 = 0; i = 1000; } if (i >= 1000) break; } - sprintf((char *) place_string1, "There are no boats left."); - sprintf((char *) place_string2,""); + sprintf((char *) place_string1, "There are no boats left."); + sprintf((char *) place_string2,""); strnum1 = -1; strnum2 = -1; break; @@ -902,7 +902,7 @@ void handle_talk_event(POINT p) strnum1 = strnum2; strnum2 = 0; strcpy((char *) place_string1,(char *) place_string2); - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); break; } else { @@ -911,21 +911,21 @@ void handle_talk_event(POINT p) party.gold -= a; put_pc_screen(); party.horses[i].property = FALSE; - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); strnum2 = 0; i = 1000; } if (i >= 1000) break; } - sprintf((char *) place_string1, "There are no horses left."); - sprintf((char *) place_string2,""); + sprintf((char *) place_string1, "There are no horses left."); + sprintf((char *) place_string2,""); strnum1 = -1; strnum2 = -1; break; case 22: if (party.spec_items[a] > 0) { - sprintf((char *) place_string1, "You already have it."); + sprintf((char *) place_string1, "You already have it."); strnum1 = -1; } else if (party.gold < b) { @@ -938,14 +938,14 @@ void handle_talk_event(POINT p) party.spec_items[a] = 1; } strnum2 = 0; - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); break; case 23: start_shop_mode(5 + b,0, 9,a,(char *)place_string1); strnum1 = -1; return; - case 24: + case 24: if (party.can_find_town[b] > 0) { } else if (party.gold < a) { @@ -958,27 +958,27 @@ void handle_talk_event(POINT p) party.can_find_town[b] = 1; } strnum2 = 0; - sprintf((char *) place_string2,""); + sprintf((char *) place_string2,""); break; case 25: talk_end_forced = TRUE; - break; + break; case 26: c_town.monst.dudes[store_m_num].attitude = 1; c_town.monst.dudes[store_m_num].mobile = 1; talk_end_forced = TRUE; - break; + break; case 27: set_town_status(0); talk_end_forced = TRUE; - break; + break; case 28: c_town.monst.dudes[store_m_num].active = 0; // Special killing effects if (sd_legit(c_town.monst.dudes[store_m_num].monst_start.spec1,c_town.monst.dudes[store_m_num].monst_start.spec2) == TRUE) party.stuff_done[c_town.monst.dudes[store_m_num].monst_start.spec1][c_town.monst.dudes[store_m_num].monst_start.spec2] = 1; talk_end_forced = TRUE; - break; + break; case 29: // town special run_special(7,2,a,c_town.p_loc,&s1,&s2,&s3); // check s1 & s2 to see if we got diff str, and, if so, munch old strs @@ -988,12 +988,12 @@ void handle_talk_event(POINT p) sprintf((char *) place_string1,""); sprintf((char *) place_string2,""); } - get_strs((char *) place_string1,(char *) place_string2,2,s1,s2); + get_strs((char *) place_string1,(char *) place_string2,2,s1,s2); if (s1 >= 0) strnum1 = 2000 + s1; if (s2 >= 0) strnum2 = 2000 + s2; put_pc_screen(); put_item_screen(stat_window,0); - break; + break; case 30: // scen special run_special(7,0,a,c_town.p_loc,&s1,&s2,&s3); // check s1 & s2 to see if we got diff str, and, if so, munch old strs @@ -1003,12 +1003,12 @@ void handle_talk_event(POINT p) sprintf((char *) place_string1,""); sprintf((char *) place_string2,""); } - get_strs((char *) place_string1,(char *) place_string2,0,s1,s2); + get_strs((char *) place_string1,(char *) place_string2,0,s1,s2); if (s1 >= 0) strnum1 = 3000 + s1; if (s2 >= 0) strnum2 = 3000 + s2; put_pc_screen(); put_item_screen(stat_window,0); - break; + break; } strcpy((char *) one_back1,(char *) old_str1); @@ -1027,14 +1027,14 @@ void do_sign(short town_num, short which_sign, short sign_type) view_loc = (is_out()) ? party.p_loc : c_town.p_loc; SetCursor(sword_curs); - + cd_create_dialog(1014,mainPtr); - + store_sign_mode = sign_type; if (terrain_pic[sign_type] < 1000) csp(1014,3,terrain_pic[sign_type]); else csp(1014,3,94); - + if (town_num >= 200) { town_num -= 200; load_outdoors(town_num % scenario.out_width, town_num / scenario.out_width,party.i_w_c.x,party.i_w_c.y, @@ -1044,9 +1044,9 @@ void do_sign(short town_num, short which_sign, short sign_type) sprintf((char *) sign_text,"%s",data_store->town_strs[120 + which_sign]); } csit(1014,2,(char *) sign_text); - + while (dialog_not_toast) - ModalDialog(); + ModalDialog(); cd_kill_dialog(1014,0); } @@ -1071,25 +1071,25 @@ Boolean prefs_event_filter (short item_hit) did_cancel = TRUE; break; - case 50: case 52: case 54: case 56: case 60: case 18: case 20: case 22: case 24: case 27: case 38: case 40: case 43: case 45: + case 50: case 52: case 54: case 56: case 60: case 18: case 20: case 22: case 24: case 27: case 38: case 40: case 43: case 45: cd_set_led(1099,item_hit,1 - cd_get_led(1099,item_hit)); break; - + case 29: cd_set_led(1099,29,1); break; - + case 32: case 34: case 36: case 47: cd_set_led(1099,32,(item_hit == 32) ? 1 : 0); cd_set_led(1099,34,(item_hit == 34) ? 1 : 0); cd_set_led(1099,36,(item_hit == 36) ? 1 : 0); cd_set_led(1099,47,(item_hit == 47) ? 1 : 0); break; - + case 58: cd_set_led(1099,58,1 - cd_get_led(1099,58)); break; - + default: cd_set_led(1099,4 + cur_display_mode,0); cur_display_mode = item_hit - 4; @@ -1113,7 +1113,7 @@ Boolean prefs_event_filter (short item_hit) party.stuff_done[305][5] = cd_get_led(1099,52); play_startup = cd_get_led(1099,54); party.stuff_done[305][7] = cd_get_led(1099,56); - party.stuff_done[307][1] = cd_get_led(1099,60); + party.stuff_done[307][1] = cd_get_led(1099,60); if(party.stuff_done[307][0] != cd_get_led(1099,58)){ //changed graphic mode (Mac vs Windows) ? party.stuff_done[307][0] = cd_get_led(1099,58);//adjust the graphic mode SDF @@ -1121,7 +1121,7 @@ Boolean prefs_event_filter (short item_hit) redraw_screen(0);//redraw screen with new graphics clear_map();//redraw map with new graphics } - + if (cd_get_led(1099,32) == 1) PSD[306][6] = 0; if (cd_get_led(1099,34) == 1) @@ -1178,7 +1178,7 @@ void pick_preferences() cd_set_led(1099,58,(party.stuff_done[307][0] != 0) ? 1 : 0); cd_set_led(1099,60,(party.stuff_done[307][1] != 0) ? 1 : 0);// talk edit box appearing ? cd_set_flag(1099,3,1); - if (PSD[306][6] == 3) + if (PSD[306][6] == 3) cd_set_led(1099,47,1); else cd_set_led(1099,32 + PSD[306][6] * 2,1); @@ -1209,12 +1209,12 @@ Boolean compatibility_event_filter (short item_hit) did_cancel = TRUE; break; - + case 7: case 9: case 11: case 13: case 15: case 17: case 19: cd_set_led(1100,item_hit,1 - cd_get_led(1100,item_hit)); break; } - + if (done_yet== TRUE) { if (did_cancel == FALSE) { party.stuff_done[309][0]=cd_get_led(1100,7); @@ -1223,7 +1223,7 @@ Boolean compatibility_event_filter (short item_hit) party.stuff_done[309][3]=cd_get_led(1100,13); party.stuff_done[309][4]=cd_get_led(1100,15); party.stuff_done[309][5]=cd_get_led(1100,17); - party.stuff_done[309][6]=cd_get_led(1100,19); + party.stuff_done[309][6]=cd_get_led(1100,19); } build_data_file(1); } @@ -1231,7 +1231,7 @@ Boolean compatibility_event_filter (short item_hit) return FALSE; } -void pick_compatibility() +void pick_compatibility() { get_reg_data(); SetCursor(sword_curs); @@ -1242,9 +1242,9 @@ void pick_compatibility() cd_set_led(1100,9,(party.stuff_done[309][1] != 0) ? 0 : 1);// party.stuff_done[309][1] legacy_kill_node cd_set_led(1100,11,(party.stuff_done[309][2] != 0) ? 0 : 1);// party.stuff_done[309][2] town_waterfalls cd_set_led(1100,13,(party.stuff_done[309][3] != 0) ? 1 : 0);// party.stuff_done[309][3] display_grass_trims - cd_set_led(1100,15,(party.stuff_done[309][4] != 0) ? 1 : 0);// party.stuff_done[309][4] special_interrupt - cd_set_led(1100,17,(party.stuff_done[309][5] != 0) ? 1 : 0);// party.stuff_done[309][5] stairway_everywhere - cd_set_led(1100,19,(party.stuff_done[309][6] != 0) ? 1 : 0);// party.stuff_done[309][6] resting_checks_timers + cd_set_led(1100,15,(party.stuff_done[309][4] != 0) ? 1 : 0);// party.stuff_done[309][4] special_interrupt + cd_set_led(1100,17,(party.stuff_done[309][5] != 0) ? 1 : 0);// party.stuff_done[309][5] stairway_everywhere + cd_set_led(1100,19,(party.stuff_done[309][6] != 0) ? 1 : 0);// party.stuff_done[309][6] resting_checks_timers if (party.help_received[110] == 0) { cd_initial_draw(1100); @@ -1344,7 +1344,7 @@ void edit_party_event_filter (short item_hit) void edit_party() { - + SetCursor(sword_curs); cd_create_dialog(989,mainPtr); @@ -1367,12 +1367,12 @@ void edit_party() void tip_of_day_event_filter (short item_hit) { char place_str[256]; - + switch (item_hit) { - case 1: + case 1: dialog_not_toast = FALSE; break; - + case 5: store_tip_page_on++; if (store_tip_page_on == NUM_HINTS) @@ -1392,9 +1392,9 @@ void tip_of_day_event_filter (short item_hit) void tip_of_day() { char place_str[256]; - + store_tip_page_on = get_ran(1,0,NUM_HINTS - 1); - + SetCursor(sword_curs); cd_create_dialog_parent_num(958,0); @@ -1404,7 +1404,7 @@ void tip_of_day() cd_set_led(958,7,give_intro_hint); - while (dialog_not_toast) ModalDialog(); + while (dialog_not_toast) ModalDialog(); cd_kill_dialog(958,0); build_data_file(2); @@ -1454,9 +1454,9 @@ void put_scen_info() difficulty[scen_headers[store_scen_page_on * 3 + i].difficulty], ratings[scen_headers[store_scen_page_on * 3 + i].default_ground], data_store2[store_scen_page_on * 3 + i].scen_header_strs[1], - data_store2[store_scen_page_on * 3 + i].scen_header_strs[2]); + data_store2[store_scen_page_on * 3 + i].scen_header_strs[2]); csit(947,7 + i * 3,(char *) place_str); - cd_activate_item(947,8 + i * 3,1); + cd_activate_item(947,8 + i * 3,1); } else { cd_set_pict(947, 6 + i * 3,950); @@ -1468,11 +1468,11 @@ void put_scen_info() void pick_a_scen_event_filter (short item_hit) { switch (item_hit) { - case 1: + case 1: dialog_answer = -1; dialog_not_toast = FALSE; break; - + case 3: case 4: if (item_hit == 3) { if (store_scen_page_on == 0) @@ -1483,10 +1483,10 @@ void pick_a_scen_event_filter (short item_hit) if (store_scen_page_on == (store_num_scen - 1) / 3) store_scen_page_on = 0; else store_scen_page_on++; - } + } put_scen_info(); break; - + case 8: case 11: case 14: dialog_answer = ((item_hit - 8) / 3) + store_scen_page_on * 3; dialog_not_toast = FALSE; @@ -1497,11 +1497,11 @@ void pick_a_scen_event_filter (short item_hit) short pick_a_scen() { - + build_scen_headers(); - + store_scen_page_on = 0; - + if (store_num_scen == 0) { FCD(868,0); return -1; @@ -1511,7 +1511,7 @@ short pick_a_scen() 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); @@ -1526,11 +1526,11 @@ short pick_a_scen() void pick_prefab_scen_event_filter (short item_hit) { switch (item_hit) { - case 1: + case 1: dialog_answer = -1; dialog_not_toast = FALSE; break; - + case 6: case 9: case 12: dialog_answer = ((item_hit - 6) / 3); dialog_not_toast = FALSE; diff --git a/Win32/Blades of Exile/boe.fileio.cpp b/Win32/Blades of Exile/boe.fileio.cpp index ec8a01fb..5d7877e5 100644 --- a/Win32/Blades of Exile/boe.fileio.cpp +++ b/Win32/Blades of Exile/boe.fileio.cpp @@ -1,5 +1,5 @@ -#include +#include #include #include @@ -49,7 +49,7 @@ BOOL check_for_interrupt(){ if(((GetAsyncKeyState(VK_LCONTROL) & 32768) == 32768) && ((GetAsyncKeyState(0x43) & 32768) == 32768)) return TRUE; - + return FALSE; } @@ -64,7 +64,7 @@ while(file_path[i] != '\\') i--; // find the last '\' in the path to the executable } // in order to get rid of 'blades of exile.exe' - + int j=0; // initialize the second loop for(j=0;j= 16) && (scenario.ter_types[t_d.terrain[j][k]].special <= 19)) belt_present = TRUE; - } + } force_wall = TRUE;fire_wall = TRUE;antimagic = TRUE;scloud = TRUE;ice_wall = TRUE;blade_wall = TRUE; sleep_field = TRUE; center = c_town.p_loc; @@ -664,7 +664,7 @@ sleep_field = TRUE; loaded_yet = TRUE; add_string_to_buf("Load: Game loaded. "); - + // Set sounds, map saving, and speed /* if (((play_sounds == TRUE) && (party.stuff_done[306][1] == 1)) || @@ -672,13 +672,13 @@ sleep_field = TRUE; play_sounds = 1 - play_sounds; } */ - give_delays = party.stuff_done[306][2]; + give_delays = party.stuff_done[306][2]; if (party.stuff_done[306][0] == 0) save_maps = TRUE; - else save_maps = FALSE; + else save_maps = FALSE; in_startup_mode = FALSE; - + } void save_file(short mode) //mode 0 - normal 1 - save as @@ -695,8 +695,8 @@ void save_file(short mode) //mode 0 - normal 1 - save as setup_save_type *setup_ptr; pc_record_type *pc_ptr; current_town_type *town_ptr; - - char *party_encryptor; + + char *party_encryptor; if ((in_startup_mode == FALSE) && (is_town())) town_save = TRUE; @@ -705,12 +705,12 @@ void save_file(short mode) //mode 0 - normal 1 - save as ofn.lpstrFile = szFileName; ofn.lpstrFileTitle = szTitleName; ofn.Flags = OFN_OVERWRITEPROMPT; - + if ((mode == 1) || (in_startup_mode == TRUE)) { if (GetSaveFileName(&ofn) == 0) return; } - + /* if (strcmpi(&ofn.lpstrFile[ofn.nFileExtension], "savx") == 0) { // for experimental formats of save-game files @@ -721,8 +721,8 @@ void save_file(short mode) //mode 0 - normal 1 - save as if (file_id == INVALID_HANDLE_VALUE) return; SetCurrentDirectory(file_path_name); - - store = &flag; + + store = &flag; flag = (town_save == TRUE) ? 1342 : 5790; if (WriteFile(file_id, store, sizeof(short), &bytes, NULL) == FALSE) @@ -744,19 +744,19 @@ void save_file(short mode) //mode 0 - normal 1 - save as } // SAVE PARTY - party_ptr = &party; + party_ptr = &party; party_encryptor = (char *) party_ptr; for (count = 0; count < sizeof(party_record_type); count++) party_encryptor[count] ^= 0x5C; - + /* if (WriteFile(file_id, party_ptr, sizeof(party_record_type), &bytes, NULL) == FALSE) { add_string_to_buf("Save: Couldn't write to file. "); CloseHandle(file_id); for (count = 0; count < store_len; count++) party_encryptor[count] ^= 0x5C; - SysBeep(2); + SysBeep(2); return; }*/ @@ -774,7 +774,7 @@ void save_file(short mode) //mode 0 - normal 1 - save as WriteFile(file_id, &party.p_loc.y, 1, &dwByteRead, NULL); WriteFile(file_id, &party.loc_in_sec.x, 1, &dwByteRead, NULL); WriteFile(file_id, &party.loc_in_sec.y, 1, &dwByteRead, NULL); - + for (i = 0; i < 30; i++) { WriteFile(file_id, &party.boats[i].boat_loc.x, 1, &dwByteRead, NULL); @@ -801,7 +801,7 @@ void save_file(short mode) //mode 0 - normal 1 - save as } for (i = 0; i < 4; i++) { - for (j = 0; j < 60; j++) + for (j = 0; j < 60; j++) { WriteFile(file_id, &party.creature_save[i].dudes[j].active, 2, &dwByteRead, NULL); WriteFile(file_id, &party.creature_save[i].dudes[j].attitude, 2, &dwByteRead, NULL); @@ -871,11 +871,11 @@ void save_file(short mode) //mode 0 - normal 1 - save as WriteFile(file_id, &party.creature_save[i].dudes[j].monst_start.facial_pic, 2, &dwByteRead, NULL); } } - + WriteFile(file_id, &party.creature_save[i].which_town, 2, &dwByteRead, NULL); WriteFile(file_id, &party.creature_save[i].friendly, 2, &dwByteRead, NULL); } - + WriteFile(file_id, &party.in_boat, 2, &dwByteRead, NULL); WriteFile(file_id, &party.in_horse, 2, &dwByteRead, NULL); for (i = 0; i < 10; i++) @@ -953,22 +953,22 @@ void save_file(short mode) //mode 0 - normal 1 - save as WriteFile(file_id, &party.total_dam_done, 4, &dwByteRead, NULL); WriteFile(file_id, &party.total_xp_gained, 4, &dwByteRead, NULL); WriteFile(file_id, &party.total_dam_taken, 4, &dwByteRead, NULL); - WriteFile(file_id, party.scen_name, 256, &dwByteRead, NULL); - + WriteFile(file_id, party.scen_name, 256, &dwByteRead, NULL); + for (count = 0; count < sizeof(party_record_type); count++) party_encryptor[count] ^= 0x5C; // SAVE SETUP - setup_ptr = &setup_save; + setup_ptr = &setup_save; if (WriteFile(file_id, setup_ptr, sizeof(setup_save_type), &bytes, NULL) == FALSE) { CloseHandle(file_id); return; } - // SAVE PCS + // SAVE PCS for (i = 0; i < 6; i++) { - pc_ptr = &adven[i]; + pc_ptr = &adven[i]; party_encryptor = (char *) pc_ptr; for (count = 0; count < sizeof(pc_record_type); count++) @@ -979,15 +979,15 @@ void save_file(short mode) //mode 0 - normal 1 - save as CloseHandle(file_id); for (count = 0; count < sizeof(pc_record_type); count++) party_encryptor[count] ^= 0x6B; - MessageBeep(MB_OK); + MessageBeep(MB_OK); return; } for (count = 0; count < sizeof(pc_record_type); count++) party_encryptor[count] ^= 0x6B; } - + if (in_startup_mode == FALSE) { - + // SAVE OUT DATA if (WriteFile(file_id, out_e, sizeof(out_info_type), &bytes, NULL) == FALSE) { @@ -995,8 +995,8 @@ void save_file(short mode) //mode 0 - normal 1 - save as return; } - if (town_save == TRUE) { - town_ptr = &c_town; + if (town_save == TRUE) { + town_ptr = &c_town; /* len = sizeof(current_town_type); if (WriteFile(file_id, town_ptr, sizeof(current_town_type), &bytes, NULL) == FALSE) @@ -1004,7 +1004,7 @@ void save_file(short mode) //mode 0 - normal 1 - save as CloseHandle(file_id); return; }*/ - + /** saving c_town **/ { @@ -1092,22 +1092,22 @@ void save_file(short mode) //mode 0 - normal 1 - save as WriteFile(file_id, &c_town.p_loc.x, 1, &dwByteRead, NULL); WriteFile(file_id, &c_town.p_loc.y, 1, &dwByteRead, NULL); } - + /** end of saving c_town **/ if (WriteFile(file_id, &t_d, sizeof(big_tr_type), &bytes, NULL) == FALSE) { CloseHandle(file_id); return; } - + if (WriteFile(file_id, &t_i, sizeof(stored_items_list), &bytes, NULL) == FALSE) { CloseHandle(file_id); return; - } + } } - - // Save stored items + + // Save stored items for (i = 0; i < 3; i++) { if (WriteFile(file_id, &stored_items[i], sizeof(stored_items_list), &bytes, NULL) == FALSE) @@ -1116,7 +1116,7 @@ void save_file(short mode) //mode 0 - normal 1 - save as return; } } - + // If saving maps, save maps if (save_maps == TRUE) { if (WriteFile(file_id, &(town_maps), sizeof(stored_town_maps_type), &bytes, NULL) == FALSE) @@ -1130,8 +1130,8 @@ void save_file(short mode) //mode 0 - normal 1 - save as CloseHandle(file_id); return; } - } - + } + // SAVE SFX and MISC_I if (WriteFile(file_id, sfx, (64 * 64), &bytes, NULL) == FALSE) { @@ -1146,7 +1146,7 @@ void save_file(short mode) //mode 0 - normal 1 - save as } CloseHandle(file_id); - + if (in_startup_mode == FALSE) add_string_to_buf("Save: Game saved. "); } @@ -1190,7 +1190,7 @@ void load_town(short town_num,short mode,short extra,char *str) len_to_jump = sizeof(scenario_data_type); len_to_jump += sizeof(scen_item_data_type); - + for (i = 0; i < 300; i++) len_to_jump += (long) scenario.scen_str_len[i]; store = 0; for (i = 0; i < 100; i++) @@ -1224,14 +1224,14 @@ void load_town(short town_num,short mode,short extra,char *str) } else SetFilePointer(file_id, sizeof(big_tr_type), NULL, FILE_CURRENT); break; - + case 1: if (mode == 0) { ReadFile(file_id, &ave_t, sizeof(ave_tr_type), &dwBytesRead, NULL); for (i = 0; i < 48; i++) for (j = 0; j < 48; j++) { t_d.terrain[i][j] = ave_t.terrain[i][j]; - t_d.lighting[i / 8][j] = ave_t.lighting[i / 8][j]; + t_d.lighting[i / 8][j] = ave_t.lighting[i / 8][j]; } for (i = 0; i < 16; i++) t_d.room_rect[i] = ave_t.room_rect[i]; for (i = 0; i < 40; i++) t_d.creatures[i] = ave_t.creatures[i]; @@ -1240,14 +1240,14 @@ void load_town(short town_num,short mode,short extra,char *str) } else SetFilePointer(file_id, sizeof(ave_tr_type), NULL, FILE_CURRENT); break; - + case 2: if (mode == 0) { ReadFile(file_id, &tiny_t, sizeof(tiny_tr_type), &dwBytesRead, NULL); for (i = 0; i < 32; i++) for (j = 0; j < 32; j++) { t_d.terrain[i][j] = tiny_t.terrain[i][j]; - t_d.lighting[i / 8][j] = tiny_t.lighting[i / 8][j]; + t_d.lighting[i / 8][j] = tiny_t.lighting[i / 8][j]; } for (i = 0; i < 16; i++) t_d.room_rect[i] = tiny_t.room_rect[i]; for (i = 0; i < 30; i++) t_d.creatures[i] = tiny_t.creatures[i]; @@ -1257,7 +1257,7 @@ void load_town(short town_num,short mode,short extra,char *str) else SetFilePointer(file_id, sizeof(tiny_tr_type), NULL, FILE_CURRENT); break; } - + for (i = 0; i < 140; i++) { len = (mode == 0) ? (long) (c_town.town.strlens[i]) : (long) (dummy_town.strlens[i]); switch (mode) { @@ -1265,11 +1265,11 @@ void load_town(short town_num,short mode,short extra,char *str) ReadFile(file_id, &(data_store->town_strs[i]), len, &dwBytesRead, NULL); data_store->town_strs[i][len] = 0; break; - + case 1: SetFilePointer(file_id, len, NULL, FILE_CURRENT); break; - + case 2: if (extra < 0) { ReadFile(file_id, &(data_store->town_strs[i]), len, &dwBytesRead, NULL); @@ -1288,22 +1288,22 @@ void load_town(short town_num,short mode,short extra,char *str) { ReadFile(file_id, &talking, sizeof(talking_record_type), &dwBytesRead, NULL); port_talk_nodes(); - + for (i = 0; i < 170; i++) { len = (long) (talking.strlens[i]); ReadFile(file_id, &(data_store3->talk_strs[i]), len, &dwBytesRead, NULL); data_store3->talk_strs[i][len] = 0; } - + cur_town_talk_loaded = town_num; } - + if (mode == 0) town_type = scenario.town_size[which_town]; CloseHandle(file_id); - + // Now more initialization is needed. First need to properly create the misc_i array. - + // Initialize barriers, etc. Note non-sfx gets forgotten if this is a town recently visited. if (mode == 0) { for (i = 0; i < 64; i++) @@ -1317,12 +1317,12 @@ void load_town(short town_num,short mode,short extra,char *str) } for (i = 0; i < 50; i++) { if ((c_town.town.preset_fields[i].field_type > 0) && (c_town.town.preset_fields[i].field_type < 9)) - misc_i[(short) c_town.town.preset_fields[i].field_loc.x][(short) c_town.town.preset_fields[i].field_loc.y] = - misc_i[(short) c_town.town.preset_fields[i].field_loc.x][(short) c_town.town.preset_fields[i].field_loc.y] | + misc_i[(short) c_town.town.preset_fields[i].field_loc.x][(short) c_town.town.preset_fields[i].field_loc.y] = + misc_i[(short) c_town.town.preset_fields[i].field_loc.x][(short) c_town.town.preset_fields[i].field_loc.y] | (unsigned char) (s_pow(2,c_town.town.preset_fields[i].field_type - 1)); if ((c_town.town.preset_fields[i].field_type >= 14) && (c_town.town.preset_fields[i].field_type <= 21)) - sfx[(short) c_town.town.preset_fields[i].field_loc.x][(short) c_town.town.preset_fields[i].field_loc.y] = - sfx[(short) c_town.town.preset_fields[i].field_loc.x][(short) c_town.town.preset_fields[i].field_loc.y] | + sfx[(short) c_town.town.preset_fields[i].field_loc.x][(short) c_town.town.preset_fields[i].field_loc.y] = + sfx[(short) c_town.town.preset_fields[i].field_loc.x][(short) c_town.town.preset_fields[i].field_loc.y] | (unsigned char) (s_pow(2,c_town.town.preset_fields[i].field_type - 14)); } } @@ -1331,9 +1331,9 @@ void load_town(short town_num,short mode,short extra,char *str) void shift_universe_left() { short i,j; - + make_cursor_watch(); - + save_outdoor_maps(); party.outdoor_corner.x--; party.i_w_c.x++; @@ -1354,7 +1354,7 @@ void shift_universe_left() for (i = 0; i < 10; i++) { if (party.out_c[i].m_loc.x > 48) party.out_c[i].exists = FALSE; - if (party.out_c[i].exists == TRUE) + if (party.out_c[i].exists == TRUE) party.out_c[i].m_loc.x += 48; } @@ -1368,7 +1368,7 @@ void shift_universe_left() void shift_universe_right() { short i,j; - + make_cursor_watch(); save_outdoor_maps(); party.outdoor_corner.x++; @@ -1389,7 +1389,7 @@ void shift_universe_right() for (i = 0; i < 10; i++) { if (party.out_c[i].m_loc.x < 48) party.out_c[i].exists = FALSE; - if (party.out_c[i].exists == TRUE) + if (party.out_c[i].exists == TRUE) party.out_c[i].m_loc.x -= 48; } load_outdoors(party.outdoor_corner.x + 1,party.outdoor_corner.y,1,0,0,0,NULL); @@ -1403,7 +1403,7 @@ void shift_universe_right() void shift_universe_up() { short i,j; - + make_cursor_watch(); save_outdoor_maps(); party.outdoor_corner.y--; @@ -1419,13 +1419,13 @@ void shift_universe_up() out_e[i][j] = out_e[i][j - 48]; for (i = 0; i < 96; i++) for (j = 0; j < 48; j++) - out_e[i][j] = 0; + out_e[i][j] = 0; for (i = 0; i < 10; i++) { if (party.out_c[i].m_loc.y > 48) party.out_c[i].exists = FALSE; if (party.out_c[i].exists == TRUE) - party.out_c[i].m_loc.y += 48; + party.out_c[i].m_loc.y += 48; } load_outdoors(party.outdoor_corner.x,party.outdoor_corner.y,0,0,0,0,NULL); load_outdoors(party.outdoor_corner.x + 1,party.outdoor_corner.y,1,0,0,0,NULL); @@ -1441,7 +1441,7 @@ void shift_universe_down() short i,j; make_cursor_watch(); - + save_outdoor_maps(); party.outdoor_corner.y++; party.i_w_c.y--; @@ -1456,17 +1456,17 @@ void shift_universe_down() out_e[i][j] = out_e[i][j + 48]; for (i = 0; i < 96; i++) for (j = 48; j < 96; j++) - out_e[i][j] = 0; + out_e[i][j] = 0; for (i = 0; i < 10; i++) { if (party.out_c[i].m_loc.y < 48) party.out_c[i].exists = FALSE; - if (party.out_c[i].exists == TRUE) + if (party.out_c[i].exists == TRUE) party.out_c[i].m_loc.y = party.out_c[i].m_loc.y - 48; } load_outdoors(party.outdoor_corner.x,party.outdoor_corner.y + 1,0,1,0,0,NULL); load_outdoors(party.outdoor_corner.x + 1,party.outdoor_corner.y + 1,1,1,0,0,NULL); - + build_outdoors(); SetCursor(sword_curs); @@ -1480,11 +1480,11 @@ void position_party(short out_x,short out_y,short pc_pos_x,short pc_pos_y) party.p_loc.x = pc_pos_x; party.p_loc.y = pc_pos_y; party.loc_in_sec = party.p_loc.toLocal(); - + if ((party.outdoor_corner.x != out_x) || (party.outdoor_corner.y != out_y)) { party.outdoor_corner.x = out_x; - party.outdoor_corner.y = out_y; + party.outdoor_corner.y = out_y; load_outdoors(party.outdoor_corner.x + 1,party.outdoor_corner.y + 1,1,1,0,0,NULL); load_outdoors(party.outdoor_corner.x,party.outdoor_corner.y + 1,0,1,0,0,NULL); load_outdoors(party.outdoor_corner.x + 1,party.outdoor_corner.y,1,0,0,0,NULL); @@ -1494,26 +1494,26 @@ void position_party(short out_x,short out_y,short pc_pos_x,short pc_pos_y) party.i_w_c.y = (party.p_loc.y > 47) ? 1 : 0; for (i = 0; i < 10; i++) party.out_c[i].exists = FALSE; for (i = 0; i < 96; i++) - for (j = 0; j < 96; j++) + for (j = 0; j < 96; j++) out_e[i][j] = 0; - build_outdoors(); + build_outdoors(); } void build_outdoors() { short i,j; - for (i = 0; i < 48; i++) + for (i = 0; i < 48; i++) for (j = 0; j < 48; j++) { out[i][j] = outdoors[0][0].terrain[i][j]; out[48 + i][j] = outdoors[1][0].terrain[i][j]; out[i][48 + j] = outdoors[0][1].terrain[i][j]; - out[48 + i][48 + j] = outdoors[1][1].terrain[i][j]; + out[48 + i][48 + j] = outdoors[1][1].terrain[i][j]; } fix_boats(); - add_outdoor_maps(); + add_outdoor_maps(); make_out_trim(); if (in_startup_mode == FALSE) erase_out_specials(); @@ -1533,28 +1533,28 @@ short onm(char x_sector,char y_sector) void save_outdoor_maps() { short i,j; - + for (i = 0; i < 48; i++) for (j = 0; j < 48; j++) { - if (out_e[i][j] > 0) + if (out_e[i][j] > 0) o_maps.outdoor_maps[onm(party.outdoor_corner.x,party.outdoor_corner.y)][i / 8][j] = o_maps.outdoor_maps[onm(party.outdoor_corner.x,party.outdoor_corner.y)][i / 8][j] | - (char) (s_pow(2,i % 8)); + (char) (s_pow(2,i % 8)); if (party.outdoor_corner.x + 1 < scenario.out_width) { - if (out_e[i + 48][j] > 0) + if (out_e[i + 48][j] > 0) o_maps.outdoor_maps[onm(party.outdoor_corner.x + 1,party.outdoor_corner.y)][i / 8][j] = o_maps.outdoor_maps[onm(party.outdoor_corner.x + 1,party.outdoor_corner.y)][i / 8][j] | (char) (s_pow(2,i % 8)); } if (party.outdoor_corner.y + 1 < scenario.out_height) { - if (out_e[i][j + 48] > 0) + if (out_e[i][j + 48] > 0) o_maps.outdoor_maps[onm(party.outdoor_corner.x,party.outdoor_corner.y + 1)][i / 8][j] = o_maps.outdoor_maps[onm(party.outdoor_corner.x,party.outdoor_corner.y + 1)][i / 8][j] | (char) (s_pow(2,i % 8)); } if ((party.outdoor_corner.y + 1 < scenario.out_height) && (party.outdoor_corner.x + 1 < scenario.out_width)) { - if (out_e[i + 48][j + 48] > 0) + if (out_e[i + 48][j + 48] > 0) o_maps.outdoor_maps[onm(party.outdoor_corner.x + 1,party.outdoor_corner.y + 1)][i / 8][j] = o_maps.outdoor_maps[onm(party.outdoor_corner.x + 1,party.outdoor_corner.y + 1)][i / 8][j] | (char) (s_pow(2,i % 8)); @@ -1566,34 +1566,34 @@ void add_outdoor_maps() // This takes the existing outdoor map info and supplem // with the saved map info { short i,j; - + for (i = 0; i < 48; i++) for (j = 0; j < 48; j++) { - if ((out_e[i][j] == 0) && + if ((out_e[i][j] == 0) && ((o_maps.outdoor_maps[onm(party.outdoor_corner.x,party.outdoor_corner.y)][i / 8][j] & (char) (s_pow(2,i % 8))) != 0)) out_e[i][j] = 1; if (party.outdoor_corner.x + 1 < scenario.out_width) { - if ((out_e[i + 48][j] == 0) && + if ((out_e[i + 48][j] == 0) && ((o_maps.outdoor_maps[onm(party.outdoor_corner.x + 1,party.outdoor_corner.y)][i / 8][j] & (char) (s_pow(2,i % 8))) != 0)) - out_e[i + 48][j] = 1; - } + out_e[i + 48][j] = 1; + } if (party.outdoor_corner.y + 1 < scenario.out_height) { - if ((out_e[i][j + 48] == 0) && + if ((out_e[i][j + 48] == 0) && ((o_maps.outdoor_maps[onm(party.outdoor_corner.x,party.outdoor_corner.y + 1)][i / 8][j] & (char) (s_pow(2,i % 8))) != 0)) out_e[i][j + 48] = 1; } if ((party.outdoor_corner.y + 1 < scenario.out_height) && (party.outdoor_corner.x + 1 < scenario.out_width)) { - if ((out_e[i + 48][j + 48] == 0) && + if ((out_e[i + 48][j + 48] == 0) && ((o_maps.outdoor_maps[onm(party.outdoor_corner.x + 1,party.outdoor_corner.y + 1)][i / 8][j] & (char) (s_pow(2,i % 8))) != 0)) out_e[i + 48][j + 48] = 1; } } -} +} void fix_boats() { @@ -1607,14 +1607,14 @@ void fix_boats() else if (party.boats[i].boat_sector.x == party.outdoor_corner.x + 1) party.boats[i].boat_loc.x = party.boats[i].boat_loc_in_sec.x + 48; else party.boats[i].boat_loc.x = 500; - - if (party.boats[i].boat_sector.y == party.outdoor_corner.y) + + if (party.boats[i].boat_sector.y == party.outdoor_corner.y) party.boats[i].boat_loc.y = party.boats[i].boat_loc_in_sec.y; else if (party.boats[i].boat_sector.y == party.outdoor_corner.y + 1) party.boats[i].boat_loc.y = party.boats[i].boat_loc_in_sec.y + 48; else party.boats[i].boat_loc.y = 500; } - + for (i = 0; i < NUM_OF_HORSES; i++) if ((party.horses[i].exists == TRUE) && (party.horses[i].which_town == INVALID_TOWN)) { if (party.horses[i].horse_sector.x == party.outdoor_corner.x) @@ -1622,7 +1622,7 @@ void fix_boats() else if (party.horses[i].horse_sector.x == party.outdoor_corner.x + 1) party.horses[i].horse_loc.x = party.horses[i].horse_loc_in_sec.x + 48; else party.horses[i].horse_loc.x = 500; - if (party.horses[i].horse_sector.y == party.outdoor_corner.y) + if (party.horses[i].horse_sector.y == party.outdoor_corner.y) party.horses[i].horse_loc.y = party.horses[i].horse_loc_in_sec.y; else if (party.horses[i].horse_sector.y == party.outdoor_corner.y + 1) party.horses[i].horse_loc.y = party.horses[i].horse_loc_in_sec.y + 48; @@ -1679,7 +1679,7 @@ void load_outdoors(short to_create_x, short to_create_y, short targ_x, short tar outdoors[targ_x][targ_y].flip(); } else ReadFile(file_id, &dummy_out, sizeof(outdoor_record_type), &dwBytesRead, NULL); - + if (mode == 0) { for (i = 0; i < 9; i++) { len = (long) (outdoors[targ_x][targ_y].strlens[i]); @@ -1687,8 +1687,8 @@ void load_outdoors(short to_create_x, short to_create_y, short targ_x, short tar data_store4->outdoor_text[targ_x][targ_y].out_strs[i][len] = 0; } } - - if (mode == 1) + + if (mode == 1) { for (i = 0; i < 120; i++) { @@ -1699,15 +1699,15 @@ void load_outdoors(short to_create_x, short to_create_y, short targ_x, short tar str[len] = 0; } SetFilePointer(file_id, len, NULL, FILE_CURRENT); - } + } } - + CloseHandle(file_id); } void get_reg_data() -{ +{ const int BUFFER_LEN = 64; char buffer[BUFFER_LEN]; const char * iniFile = "./blades.ini"; @@ -1727,7 +1727,7 @@ void get_reg_data() GetPrivateProfileString(section, "darker_graphics", "0", buffer, BUFFER_LEN, iniFile); party.stuff_done[307][0] = atoi(buffer); //1 is darker GetPrivateProfileString(section, "talk_edit_box", "0", buffer, BUFFER_LEN, iniFile); - party.stuff_done[307][1] = atoi(buffer); //1 is darker + party.stuff_done[307][1] = atoi(buffer); //1 is darker GetPrivateProfileString(section, "legacy_day_reached", "0", buffer, BUFFER_LEN, iniFile); party.stuff_done[309][0] = atoi(buffer); //1 is legacy GetPrivateProfileString(section, "legacy_kill_node", "1", buffer, BUFFER_LEN, iniFile); @@ -1741,7 +1741,7 @@ void get_reg_data() GetPrivateProfileString(section, "stairway_everywhere", "0", buffer, BUFFER_LEN, iniFile); party.stuff_done[309][5] = atoi(buffer); GetPrivateProfileString(section, "resting_checks_timers", "0", buffer, BUFFER_LEN, iniFile); - party.stuff_done[309][6] = atoi(buffer); + party.stuff_done[309][6] = atoi(buffer); } @@ -1758,7 +1758,7 @@ void build_data_file(short which) // 1 - compatibility ; 2 - preferences WritePrivateProfileString(section, "no_instant_help", itoa((int) party.stuff_done[SDF_NO_INSTANT_HELP], tmp, 10), iniFile); WritePrivateProfileString(section, "fancy_startup", (play_startup == TRUE) ? "1" : "0", iniFile); WritePrivateProfileString(section, "darker_graphics", (party.stuff_done[307][0] == 0) ? "0": "1", iniFile); - WritePrivateProfileString(section, "talk_edit_box", (party.stuff_done[307][1] == 0) ? "0": "1", iniFile); + WritePrivateProfileString(section, "talk_edit_box", (party.stuff_done[307][1] == 0) ? "0": "1", iniFile); } if(which == 1){ WritePrivateProfileString(section, "legacy_day_reached", (party.stuff_done[309][0] == 0)? "0" : "1", iniFile); @@ -1766,8 +1766,8 @@ void build_data_file(short which) // 1 - compatibility ; 2 - preferences WritePrivateProfileString(section, "town_waterfalls", (party.stuff_done[309][2] == 0)? "1" : "0", iniFile); WritePrivateProfileString(section, "display_grass_trims", (party.stuff_done[309][3] == 0)? "0" : "1", iniFile); WritePrivateProfileString(section, "special_interrupt", (party.stuff_done[309][4] == 0)? "0" : "1", iniFile); - WritePrivateProfileString(section, "stairway_everywhere", (party.stuff_done[309][5] == 0)? "0" : "1", iniFile); - WritePrivateProfileString(section, "resting_checks_timers", (party.stuff_done[309][6] == 0)? "0" : "1", iniFile); + WritePrivateProfileString(section, "stairway_everywhere", (party.stuff_done[309][5] == 0)? "0" : "1", iniFile); + WritePrivateProfileString(section, "resting_checks_timers", (party.stuff_done[309][6] == 0)? "0" : "1", iniFile); } } @@ -1779,19 +1779,19 @@ Boolean load_scenario() // OK Boolean file_ok = FALSE; DWORD len, dwByteRead; char file_name[256]; - + sprintf(file_name,"scenarios/%s",party.scen_name); - + file_id = CreateFile(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (file_id == INVALID_HANDLE_VALUE) return FALSE; - + if (ReadFile(file_id, &scenario, sizeof(scenario_data_type), &dwByteRead, NULL) == FALSE) { CloseHandle(file_id); return FALSE; } - + if ((scenario.flag1 == 10) && (scenario.flag2 == 20) && (scenario.flag3 == 30) && (scenario.flag4 == 40)) { @@ -1805,23 +1805,23 @@ Boolean load_scenario() // OK file_ok = TRUE; cur_scen_is_win = TRUE; } - + if (file_ok == FALSE) { CloseHandle(file_id); give_error("This is not a legitimate Blades of Exile scenario.","",0); - return FALSE; + return FALSE; } - - // item data + + // item data if (ReadFile(file_id, scen_item_list, sizeof(scen_item_data_type), &dwByteRead, NULL) == FALSE) { CloseHandle(file_id); return FALSE; } - + port_item_list(); - + for (i = 0; i < 270; i++) { len = (DWORD) (scenario.scen_str_len[i]); if (i < 160) @@ -1834,15 +1834,15 @@ Boolean load_scenario() // OK scen_strs2[i - 160][len] = 0; } } - + CloseHandle(file_id); - + if (spec_scen_g != NULL) { DeleteObject(spec_scen_g); spec_scen_g = NULL; } - + sprintf(file_name,"scenarios/%s",party.scen_name); for (i = 0; i < 256; i++) { if (file_name[i] == '.') { @@ -1852,7 +1852,7 @@ Boolean load_scenario() // OK i = 256; } } - + spec_scen_g = ReadBMP(file_name); set_up_ter_pics(); @@ -1870,7 +1870,7 @@ void set_up_ter_pics() void oops_error(short error) { char error_str[256]; - + MessageBeep(MB_OK); sprintf((char *) error_str,"Giving the scenario editor more memory might also help. Be sure to back your scenario up often. Error number: %d.",error); give_error("The program encountered an error while loading/saving/creating the scenario. To prevent future problems, the program will now terminate. Trying again may solve the problem.",(char *) error_str,0); @@ -1883,18 +1883,18 @@ void ListFiles(char *path, HWND listbox){ HANDLE find_file_id; WIN32_FIND_DATA lpFindFileData; char copy_str[256]; - + sprintf(copy_str,"scenarios/%s*.*",path); - + if((find_file_id = FindFirstFile(copy_str,&lpFindFileData)) == INVALID_HANDLE_VALUE){// is directory empty ? FindClose(find_file_id); return; } - + do{ if((strcmp(lpFindFileData.cFileName, "VALLEYDY.EXS") != 0) && (strcmp(lpFindFileData.cFileName, "STEALTH.EXS") != 0) && (strcmp(lpFindFileData.cFileName, "ZAKHAZI.EXS") != 0)){ len = strlen(lpFindFileData.cFileName); - if(((lpFindFileData.cFileName[len-1] == 's') ||( lpFindFileData.cFileName[len-1] == 'S')) + if(((lpFindFileData.cFileName[len-1] == 's') ||( lpFindFileData.cFileName[len-1] == 'S')) && ((lpFindFileData.cFileName[len-2] == 'x') || (lpFindFileData.cFileName[len-2] == 'X')) && ((lpFindFileData.cFileName[len-3] == 'e') || (lpFindFileData.cFileName[len-3] == 'E'))){// is extension .exs ? sprintf(copy_str,"%s%s",path,lpFindFileData.cFileName); @@ -1908,7 +1908,7 @@ void ListFiles(char *path, HWND listbox){ }while(FindNextFile(find_file_id,&lpFindFileData) != 0); FindClose(find_file_id); - + } void build_scen_headers() @@ -1917,23 +1917,23 @@ void build_scen_headers() HWND listbox; WORD count; char filename[256],filename2[256]; - + listbox = CreateWindow("listbox", NULL, WS_CHILDWINDOW, // 3 0,0,0,0, // 7 mainPtr, // 8 (HMENU) 1, // 9 (HINSTANCE) GetWindowLong(mainPtr, GWL_HINSTANCE), // 10 NULL); // 11 - + ListFiles("", listbox);//First list the scenarios under the scenarios folder - + // SendMessage(listbox,LB_DIR,0x0,(LPARAM) (LPCTSTR) "scenarios/*.exs"); count = (WORD) SendMessage(listbox,LB_GETCOUNT,0,0L); if(count == 0){ store_num_scen = 0; - return; + return; } // memory allocation (if there's an invalid file, the memory is allocated too, but unused) if(data_store2 != NULL){ @@ -1941,16 +1941,16 @@ void build_scen_headers() data_store2 = NULL; } - data_store2 = new piles_of_stuff_dumping_type2[count]; + data_store2 = new piles_of_stuff_dumping_type2[count]; if(scen_headers != NULL){ delete[] scen_headers; scen_headers = NULL; } - + scen_headers = new scen_header_type[count]; -// end of memory allocation +// end of memory allocation for (i = 0; i < count; i++) { @@ -1961,13 +1961,13 @@ void build_scen_headers() if (load_scenario_header(filename,current_entry) == TRUE){ // now we need to store the file name, first stripping any path that occurs // before it - strcpy(data_store2[current_entry].scen_names, filename2); + strcpy(data_store2[current_entry].scen_names, filename2); current_entry++; } } store_num_scen = current_entry; //number of valid scenarios - + /*for (i = 0; i < count ; i++) if (scen_headers[i].flag1 != 0) store_num_scen++;*/ @@ -1987,17 +1987,17 @@ Boolean load_scenario_header(char *filename,short header_entry) DWORD len, dwByteRead; char load_str[256]; Boolean mac_header = TRUE; - + file_id = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (file_id == INVALID_HANDLE_VALUE) return FALSE; - + if (ReadFile(file_id, &(scen_headers[header_entry]), sizeof(scen_header_type), &dwByteRead, NULL) == FALSE) { CloseHandle(file_id); return FALSE; } - + if ((scen_headers[header_entry].flag1 == 10) && (scen_headers[header_entry].flag2 == 20) && (scen_headers[header_entry].flag3 == 30) && (scen_headers[header_entry].flag4 == 40)) @@ -2012,7 +2012,7 @@ Boolean load_scenario_header(char *filename,short header_entry) file_ok = TRUE; mac_header = FALSE; } - + if (file_ok == FALSE) { scen_headers[header_entry].flag1 = 0; @@ -2031,9 +2031,9 @@ Boolean load_scenario_header(char *filename,short header_entry) store = scenario.rating; if (mac_header == TRUE) flip_short(&store); scen_headers[header_entry].default_ground = store; - + SetFilePointer(file_id, sizeof(scen_item_data_type), NULL, FILE_CURRENT); - + for (i = 0; i < 3; i++) { store = (WORD) scenario.scen_str_len[i]; @@ -2042,10 +2042,10 @@ Boolean load_scenario_header(char *filename,short header_entry) load_str[len] = 0; if (i == 0) load_str[29] = 0; else load_str[59] = 0; - + strcpy(data_store2[header_entry].scen_header_strs[i],load_str); } - + CloseHandle(file_id); return TRUE; } @@ -2088,44 +2088,44 @@ void port_town(short mode)//0 scenario port, 1 save port <= check already done i flip_short(&c_town.town.max_num_monst); flip_short(&c_town.town.spec_on_entry); flip_short(&c_town.town.spec_on_entry_if_dead); - for (i =0 ; i < 8; i++) + for (i =0 ; i < 8; i++) flip_short(&c_town.town.timer_spec_times[i]); - for (i =0 ; i < 8; i++) + for (i =0 ; i < 8; i++) flip_short(&c_town.town.timer_specs[i]); flip_short(&c_town.town.difficulty); - for (i =0 ; i < 100; i++) + for (i =0 ; i < 100; i++) c_town.town.specials[i].flip(); if(mode == 1){ flip_short(&c_town.monst.friendly); flip_short(&c_town.monst.which_town); - + for(i=0;i<60;i++){ flip_short(&c_town.monst.dudes[i].active); - flip_short(&c_town.monst.dudes[i].attitude); + flip_short(&c_town.monst.dudes[i].attitude); flip_short(&c_town.monst.dudes[i].summoned); - + flip_short(&c_town.monst.dudes[i].monst_start.spec1); flip_short(&c_town.monst.dudes[i].monst_start.spec2); flip_short(&c_town.monst.dudes[i].monst_start.monster_time); flip_short(&c_town.monst.dudes[i].monst_start.personality); flip_short(&c_town.monst.dudes[i].monst_start.special_on_kill); flip_short(&c_town.monst.dudes[i].monst_start.facial_pic); - + for(j=0;j<3;j++) flip_short(&c_town.monst.dudes[i].m_d.a[j]); flip_short(&c_town.monst.dudes[i].m_d.corpse_item); flip_short(&c_town.monst.dudes[i].m_d.corpse_item_chance); flip_short(&c_town.monst.dudes[i].m_d.health); flip_short(&c_town.monst.dudes[i].m_d.m_health); - flip_short(&c_town.monst.dudes[i].m_d.m_morale); - flip_short(&c_town.monst.dudes[i].m_d.max_mp); - flip_short(&c_town.monst.dudes[i].m_d.morale); - flip_short(&c_town.monst.dudes[i].m_d.mp); - flip_short(&c_town.monst.dudes[i].m_d.picture_num); + flip_short(&c_town.monst.dudes[i].m_d.m_morale); + flip_short(&c_town.monst.dudes[i].m_d.max_mp); + flip_short(&c_town.monst.dudes[i].m_d.morale); + flip_short(&c_town.monst.dudes[i].m_d.mp); + flip_short(&c_town.monst.dudes[i].m_d.picture_num); for(j=0;j<15;j++) - flip_short(&c_town.monst.dudes[i].m_d.status[j]); - } + flip_short(&c_town.monst.dudes[i].m_d.status[j]); + } } } @@ -2151,12 +2151,12 @@ void port_town(short mode)//0 scenario port, 1 save port <= check already done i flip_short(&c_town.town.max_num_monst); flip_short(&c_town.town.spec_on_entry); flip_short(&c_town.town.spec_on_entry_if_dead); - for (i =0 ; i < 8; i++) + for (i =0 ; i < 8; i++) flip_short(&c_town.town.timer_spec_times[i]); - for (i =0 ; i < 8; i++) + for (i =0 ; i < 8; i++) flip_short(&c_town.town.timer_specs[i]); flip_short(&c_town.town.difficulty); - for (i =0 ; i < 100; i++) + for (i =0 ; i < 100; i++) c_town.town.specials[i].flip(); }*/ @@ -2264,7 +2264,7 @@ void port_scenario() void port_party(){ int i,j,k; - + flip_long(&party.age); flip_short(&party.food); flip_short(&party.gold); @@ -2277,7 +2277,7 @@ void port_party(){ } for (i = 0; i < 4; i++) { - for (j = 0; j < 60; j++) + for (j = 0; j < 60; j++) { flip_short(&party.creature_save[i].dudes[j].active); flip_short(&party.creature_save[i].dudes[j].attitude); @@ -2306,7 +2306,7 @@ void port_party(){ flip_short(&party.creature_save[i].dudes[j].monst_start.facial_pic); } } - + flip_short(&party.creature_save[i].which_town); flip_short(&party.creature_save[i].friendly); } @@ -2337,7 +2337,7 @@ for (i = 0; i < 10; i++) flip_short(&party.journal_day[k]); for(k=0;k<140;k++){ flip_short(&party.special_notes_str[k][0]); - flip_short(&party.special_notes_str[k][1]); + flip_short(&party.special_notes_str[k][1]); } for (i = 0; i < 120; i++) { @@ -2367,7 +2367,7 @@ for (i = 0; i < 10; i++) void port_pc(){ int i,j; - + for(i=0;i<6;i++){ flip_short(&adven[i].cur_health); flip_short(&adven[i].cur_sp); @@ -2378,14 +2378,14 @@ void port_pc(){ flip_short(&adven[i].main_status); flip_short(&adven[i].max_health); flip_short(&adven[i].max_sp); - flip_short(&adven[i].race); + flip_short(&adven[i].race); flip_short(&adven[i].skill_pts); for(j=0;j<30;j++) flip_short(&adven[i].skills[j]); for(j=0;j<15;j++) flip_short(&adven[i].status[j]); flip_short(&adven[i].weap_poisoned); - flip_short(&adven[i].which_graphic); + flip_short(&adven[i].which_graphic); for(j=0;j<24;j++){ flip_short(&adven[i].items[j].item_level); flip_short(&adven[i].items[j].value); @@ -2491,7 +2491,7 @@ void flip_long(long *s) store = *s2; *s2 = *s3; *s3 = store;*/ - + *s=((*s&255)<<24)|(((*s>>8)&255) << 16)|(((*s>>16)&255) << 8)|((*s >> 24)&255); } diff --git a/Win32/Blades of Exile/boe.graphics.cpp b/Win32/Blades of Exile/boe.graphics.cpp index 7bf471a0..797993a4 100644 --- a/Win32/Blades of Exile/boe.graphics.cpp +++ b/Win32/Blades of Exile/boe.graphics.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/Win32/Blades of Exile/boe.locutils.cpp b/Win32/Blades of Exile/boe.locutils.cpp index b809a958..b7ba4dbf 100644 --- a/Win32/Blades of Exile/boe.locutils.cpp +++ b/Win32/Blades of Exile/boe.locutils.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "global.h" #include "boe.locutils.h" @@ -53,7 +53,7 @@ short set_direction (location old_pt, location new_pt) return 1; if (old_pt.y < new_pt.y) return 3; - return 2; + return 2; } Boolean loc_off_world(location p1) @@ -77,21 +77,21 @@ location get_cur_loc() case MODE_OUTDOORS: case 35: return party.p_loc; break; - + case MODE_TOWN: case 2: case 3: case 4: case 36: return c_town.p_loc; break; - + default: return pc_pos[current_pc]; - break; + break; } } short short_can_see(shortloc p1,shortloc p2) { location s1,s2; - + s1.x = (char) p1.x; s1.y = (char) p1.y; s2.x = (char) p2.x; @@ -159,11 +159,11 @@ short can_see(location p1,location p2,short mode) return 5; } } - return storage; + return storage; } dx = p2.x - p1.x; dy = p2.y - p1.y; - + if (ex_abs(dy) > ex_abs(dx)) { if (p2.y > p1.y) { for (count = 1; count < dy; count++) { @@ -172,7 +172,7 @@ short can_see(location p1,location p2,short mode) (is_lava(p1.x + (count * dx) / dy,p1.y + count) == TRUE)) && (mode == 1)) return 5; - } + } } else { for (count = -1; count > dy; count--) { @@ -180,11 +180,11 @@ short can_see(location p1,location p2,short mode) if ( ((terrain_blocked[coord_to_ter(p1.x + (count * dx) / dy, p1.y + count)] > 2) || (is_lava(p1.x + (count * dx) / dy, p1.y + count) == TRUE)) && (mode == 1)) - return 5; + return 5; } } return storage; - } + } if (ex_abs(dy) <= ex_abs(dx)) { if (p2.x > p1.x) { for (count = 1; count < dx; count++) { @@ -205,7 +205,7 @@ short can_see(location p1,location p2,short mode) } } return storage; - } + } if (storage > 5) return 5; else return storage; @@ -215,23 +215,23 @@ short get_obscurity(short x,short y) { unsigned char what_terrain; short store; - + what_terrain = coord_to_ter(x,y); - + if ((what_terrain >= 237) && (what_terrain <= 242)) return 1; - + store = get_blockage(what_terrain); - - if (is_town()) + + if (is_town()) if (special(x,y)) store++; - if ((is_town()) || (is_combat())) + if ((is_town()) || (is_combat())) { if (is_web(x,y)) store += 2; if ((is_fire_barrier(x,y)) || (is_force_barrier(x,y))) return 5; if ((is_crate(x,y)) || (is_barrel(x,y)))store++; - } + } return store; } @@ -250,7 +250,7 @@ unsigned char coord_to_ter(short x,short y) Boolean is_container(location loc) { unsigned char ter; - + if ((is_barrel(loc.x,loc.y)) || (is_crate(loc.x,loc.y))) return TRUE; ter = coord_to_ter(loc.x,loc.y); if (scenario.ter_types[ter].special == 14) return TRUE; @@ -265,10 +265,10 @@ void update_explored(location dest) shortdest.x = (short) dest.x; shortdest.y = (short) dest.y; - + which_party_sec.x = party.outdoor_corner.x + party.i_w_c.x; which_party_sec.y = party.outdoor_corner.y + party.i_w_c.y; - + if (overall_mode == MODE_OUTDOORS) { out_e[dest.x][dest.y] = 2; for (look.x = shortdest.x - 4; look.x < shortdest.x + 5; look.x++) @@ -278,11 +278,11 @@ void update_explored(location dest) if (short_can_see(shortdest, look) < 5) out_e[look.x][look.y] = 1; } - } - + } + } - + if (overall_mode > MODE_OUTDOORS) { make_explored(dest.x,dest.y); for (look2.x = max(0,dest.x - 4); look2.x < min(town_size[town_type],dest.x + 5); look2.x++) @@ -307,27 +307,27 @@ Boolean is_blocked(location to_check) if (same_point (to_check,party.p_loc) == TRUE) return TRUE; for (i = 0; i < 20; i++) - if ((party.out_c[i].exists) == TRUE) + if ((party.out_c[i].exists) == TRUE) if (same_point(party.out_c[i].m_loc, to_check) == TRUE) return TRUE; return FALSE; } - + if ((is_town()) || (is_combat())) { ter = (is_town()) ? t_d.terrain[to_check.x][to_check.y] : combat_terrain[to_check.x][to_check.y]; gr = scenario.ter_types[ter].picture; - + // Terrain blocking? if (impassable(ter) == TRUE) { return TRUE; } - + // Keep away from marked specials during combat if ((is_combat()) && (gr <= 212) && (gr >= 207)) return TRUE; if ((is_combat()) && (gr == 406))//portal return TRUE; - + // Party there? if (is_town()) if (same_point (to_check,c_town.p_loc) == TRUE) @@ -336,15 +336,15 @@ Boolean is_blocked(location to_check) for (i = 0; i < 6; i++) if ((adven[i].isAlive()) && (same_point (to_check,pc_pos[i]) == TRUE)) return TRUE; - + // Monster there? if (monst_there(to_check) < 90) return TRUE; - + // Magic barrier? if (is_force_barrier(to_check.x,to_check.y)) return TRUE; - + return FALSE; } return TRUE; @@ -354,13 +354,13 @@ Boolean monst_on_space(location loc,short m_num) { if (c_town.monst.dudes[m_num].active == 0) return FALSE; - if ((loc.x - c_town.monst.dudes[m_num].m_loc.x >= 0) && + if ((loc.x - c_town.monst.dudes[m_num].m_loc.x >= 0) && (loc.x - c_town.monst.dudes[m_num].m_loc.x <= c_town.monst.dudes[m_num].m_d.x_width - 1) && - (loc.y - c_town.monst.dudes[m_num].m_loc.y >= 0) && + (loc.y - c_town.monst.dudes[m_num].m_loc.y >= 0) && (loc.y - c_town.monst.dudes[m_num].m_loc.y <= c_town.monst.dudes[m_num].m_d.y_width - 1)) return TRUE; - return FALSE; - + return FALSE; + } short monst_there(location where) // returns 90 if no { @@ -369,16 +369,16 @@ short monst_there(location where) // returns 90 if no for (i = 0; i < T_M; i++) if ((c_town.monst.dudes[i].active != 0) && (monst_on_space(where,i) == TRUE)) return i; - return 90; + return 90; } Boolean monst_can_be_there(location loc,short m_num) { short i,j; location destination; - + // First clear monst away so it doesn't block itself c_town.monst.dudes[m_num].m_loc.x += 100; - + for (i = 0; i < c_town.monst.dudes[m_num].m_d.x_width; i++) for (j = 0; j < c_town.monst.dudes[m_num].m_d.y_width; j++) { destination.x = loc.x + i; destination.y = loc.y + j; @@ -386,9 +386,9 @@ Boolean monst_can_be_there(location loc,short m_num) || (loc_off_act_area(destination) == TRUE)) { c_town.monst.dudes[m_num].m_loc.x -= 100; return FALSE; - } + } } - c_town.monst.dudes[m_num].m_loc.x -= 100; + c_town.monst.dudes[m_num].m_loc.x -= 100; return TRUE; } @@ -396,10 +396,10 @@ Boolean monst_adjacent(location loc,short m_num) { short i,j; location destination; - + for (i = 0; i < c_town.monst.dudes[m_num].m_d.x_width; i++) for (j = 0; j < c_town.monst.dudes[m_num].m_d.y_width; j++) { - destination.x = c_town.monst.dudes[m_num].m_loc.x + i; + destination.x = c_town.monst.dudes[m_num].m_loc.x + i; destination.y = c_town.monst.dudes[m_num].m_loc.y + j; if (adjacent(destination,loc) == TRUE) return TRUE; @@ -411,10 +411,10 @@ Boolean monst_can_see(short m_num,location l) { short i,j; location destination; - + for (i = 0; i < c_town.monst.dudes[m_num].m_d.x_width; i++) for (j = 0; j < c_town.monst.dudes[m_num].m_d.y_width; j++) { - destination.x = c_town.monst.dudes[m_num].m_loc.x + i; + destination.x = c_town.monst.dudes[m_num].m_loc.x + i; destination.y = c_town.monst.dudes[m_num].m_loc.y + j; if (can_see(destination,l,0) < 5) return TRUE; @@ -426,10 +426,10 @@ Boolean party_can_see_monst(short m_num) { short i,j; location destination; - + for (i = 0; i < c_town.monst.dudes[m_num].m_d.x_width; i++) for (j = 0; j < c_town.monst.dudes[m_num].m_d.y_width; j++) { - destination.x = c_town.monst.dudes[m_num].m_loc.x + i; + destination.x = c_town.monst.dudes[m_num].m_loc.x + i; destination.y = c_town.monst.dudes[m_num].m_loc.y + j; if (party_can_see(destination) < 6) return TRUE; @@ -441,10 +441,10 @@ Boolean can_see_monst(location l,short m_num) { short i,j; location destination; - + for (i = 0; i < c_town.monst.dudes[m_num].m_d.x_width; i++) for (j = 0; j < c_town.monst.dudes[m_num].m_d.y_width; j++) { - destination.x = c_town.monst.dudes[m_num].m_loc.x + i; + destination.x = c_town.monst.dudes[m_num].m_loc.x + i; destination.y = c_town.monst.dudes[m_num].m_loc.y + j; if (can_see(l,destination,0) < 5) return TRUE; @@ -461,7 +461,7 @@ Boolean outd_is_blocked(location to_check) return TRUE; } for (i = 0; i < 10; i++) - if ((party.out_c[i].exists) == TRUE) + if ((party.out_c[i].exists) == TRUE) if (same_point(party.out_c[i].m_loc, to_check) == TRUE) return TRUE; return FALSE; @@ -520,7 +520,7 @@ short light_radius() { short store = 1,i; short extra_levels[6] = {10,20,50,75,110,140}; - + if (((which_combat_type == 0) && (is_combat())) || (is_out()) || (c_town.town.lighting == 0)) return 200; @@ -539,7 +539,7 @@ Boolean pt_in_light(location from_where,location to_where) // Assumes, of course return TRUE; if (t_d.lighting[to_where.x / 8][to_where.y] & (char) (s_pow(2,to_where.x % 8))) return TRUE; - + if (dist(from_where,to_where) <= light_radius()) return TRUE; @@ -556,7 +556,7 @@ Boolean combat_pt_in_light(location to_where) || (to_where.y < 0) || (to_where.y >= town_size[town_type])) return TRUE; if (t_d.lighting[to_where.x / 8][to_where.y] & (char) (s_pow(2,to_where.x % 8))) - return TRUE; + return TRUE; rad = light_radius(); for (i = 0; i < 6; i++) @@ -571,14 +571,14 @@ Boolean combat_pt_in_light(location to_where) Boolean party_sees_a_monst() // Returns true is a hostile monster is in sight. { short i; - + for (i = 0; i < T_M; i++) { if (c_town.monst.dudes[i].active > 0) if ((c_town.monst.dudes[i].attitude == 1) && (party_can_see_monst(i) == TRUE)) return TRUE; } - + return FALSE; } @@ -587,7 +587,7 @@ Boolean party_sees_a_monst() // Returns true is a hostile monster is in sight. short party_can_see(location where) { short i; - + if (is_out()) { if ((point_onscreen(party.p_loc,where) == TRUE) && (can_see(party.p_loc,where,0) < 5)) return 1; @@ -599,7 +599,7 @@ short party_can_see(location where) return 1; else return 6; } - + // Now for combat checks. Doing separately for efficiency. Check first for light. If // dark, give up. if ((which_combat_type != 0) && (combat_pt_in_light(where) == FALSE)) @@ -620,11 +620,11 @@ location push_loc(location from_where,location to_where) loc_to_try = to_where; loc_to_try.x = loc_to_try.x + (to_where.x - from_where.x); loc_to_try.y = loc_to_try.y + (to_where.y - from_where.y); - if ((t_d.terrain[loc_to_try.x][loc_to_try.y] == 90) || + if ((t_d.terrain[loc_to_try.x][loc_to_try.y] == 90) || ((t_d.terrain[loc_to_try.x][loc_to_try.y] >= 50)&& (t_d.terrain[loc_to_try.x][loc_to_try.y] <= 64)) - || (t_d.terrain[loc_to_try.x][loc_to_try.y] == 71) - || ((t_d.terrain[loc_to_try.x][loc_to_try.y] >= 74)&& (t_d.terrain[loc_to_try.x][loc_to_try.y] <= 78)) - ) { + || (t_d.terrain[loc_to_try.x][loc_to_try.y] == 71) + || ((t_d.terrain[loc_to_try.x][loc_to_try.y] >= 74)&& (t_d.terrain[loc_to_try.x][loc_to_try.y] <= 78)) + ) { // Destroy crate loc_to_try.x = 0; return loc_to_try; @@ -653,12 +653,12 @@ Boolean spot_impassable(short i,short j) void alter_space(short i,short j,unsigned char ter) { location l; - + l.x = i; l.y = j; - map_graphic_placed[i / 8][j] = + map_graphic_placed[i / 8][j] = map_graphic_placed[i / 8][j] & ~((unsigned char)(s_pow(2,i % 8))); - + if (is_out()) { l = l.toGlobal(); out[l.x][l.y] = ter; @@ -669,6 +669,6 @@ void alter_space(short i,short j,unsigned char ter) combat_terrain[i][j] = ter; if ((scenario.ter_types[t_d.terrain[i][j]].special >= 16) && (scenario.ter_types[t_d.terrain[i][j]].special <= 19)) - belt_present = TRUE; + belt_present = TRUE; } } diff --git a/Win32/Blades of Exile/boe.main.cpp b/Win32/Blades of Exile/boe.main.cpp index d73a49cd..5ef3d3d2 100644 --- a/Win32/Blades of Exile/boe.main.cpp +++ b/Win32/Blades of Exile/boe.main.cpp @@ -37,31 +37,31 @@ 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++) + + 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); - + + 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: /* how to order button */ //draw_startup(0); @@ -72,7 +72,7 @@ Boolean handle_startup_press(POINT the_point) 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; @@ -119,7 +119,7 @@ void loadCursors() for (int j = 0; j < 3; j++) arrow_curs[i][j] = LoadCursor(store_hInstance,MAKEINTRESOURCE(100 + (i - 1) + 10 * (j - 1))); - + sword_curs = LoadCursor(store_hInstance,MAKEINTRESOURCE(120)); key_curs = LoadCursor(store_hInstance,MAKEINTRESOURCE(122)); target_curs = LoadCursor(store_hInstance,MAKEINTRESOURCE(124)); @@ -160,7 +160,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmd wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass.lpszMenuName = MAKEINTRESOURCE(1); wndclass.lpszClassName = szAppName; - + RegisterClass(&wndclass); wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; @@ -173,10 +173,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmd wndclass2.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass2.lpszMenuName = NULL; wndclass2.lpszClassName = szWinName; - + RegisterClass(&wndclass2); - mainPtr = CreateWindow (szAppName, "Classic Blades of Exile 1.1", + mainPtr = CreateWindow (szAppName, "Classic Blades of Exile build_26.05.2010", WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 0, 0, @@ -187,29 +187,29 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmd hInstance, NULL); - if (!hPrevInstance) + 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; @@ -240,16 +240,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmd 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." , @@ -257,7 +257,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmd 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); @@ -275,7 +275,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmd } event_handled = FALSE; - + while(GetMessage(&msg,NULL,0,0)) { if (event_handled == FALSE) @@ -286,8 +286,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmd DispatchMessage(&msg); } } - } - + } + delete scen_item_list; delete data_store5; delete data_store4; @@ -297,11 +297,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmd if(scen_headers != NULL) delete[] scen_headers; delete data_store; - + lose_graphics(); - + FreeLibrary((HMODULE) boeSoundsDLL); - + return msg.wParam; } @@ -313,7 +313,7 @@ long CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) HMENU menu; RECT dlg_rect; RECT wind_rect; - + short handled = 0; short store_ulx; short store_uly; @@ -325,7 +325,7 @@ long CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) // First, handle window size GetWindowRect(mainPtr,&wind_rect); - + switch (display_mode) { //case 0 is center case 1: store_ulx = 0; store_uly = 0; @@ -347,10 +347,10 @@ long CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) store_uly = ((wind_rect.bottom - wind_rect.top) - 478) / 2 + 8; break; } - + store_ulx -= store_ulx % 8; store_uly -= store_uly % 8; - + if ((store_ulx != ulx) || (store_uly != uly)) { ulx = store_ulx; @@ -369,7 +369,7 @@ long CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } if (handled == 1) FlushEvents(0); - + return 0; case WM_CHAR: @@ -388,7 +388,7 @@ long CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) else { SetFocus(hwnd); press = MAKEPOINT(lParam); - if (in_startup_mode == FALSE) + if (in_startup_mode == FALSE) All_Done = handle_action(press, wParam,lParam); else All_Done = handle_startup_press(press); change_cursor(press); @@ -412,19 +412,19 @@ long CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } return 0; break; - + case WM_ACTIVATE: if (hwnd == mainPtr) { WORD fActive = LOWORD(wParam); - + if ((fActive == WA_ACTIVE) ||(fActive == WA_CLICKACTIVE)) { window_in_front = TRUE; GetClientRect(hwnd,&dlg_rect); InvalidateRect(hwnd,&dlg_rect,FALSE); } - + if (fActive == WA_INACTIVE) { cursor_stay(); @@ -438,7 +438,7 @@ long CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (hwnd != mainPtr) break; block_erase = FALSE; return 1; - + case WM_MOUSEMOVE: if (store_mouse != lParam) cursor_stay(); store_mouse = lParam; @@ -463,7 +463,7 @@ long CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) string_added = TRUE; reset_text_bar(); if (in_startup_mode == TRUE) draw_startup(0); - else if (first_update == TRUE) + else if (first_update == TRUE) { first_update = FALSE; if (overall_mode == 0) redraw_screen(0); @@ -504,7 +504,7 @@ long CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) check_game_done(); } else check_cd_event(hwnd,message,wParam,lParam); - + return 0; case WM_VSCROLL: @@ -582,10 +582,10 @@ long CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) SetScrollInfo(shop_sbar,SB_CTL,&lpsi,TRUE); } if (sbar_pos != old_setting) - draw_shop_graphics(0,shop_sbar_rect); + draw_shop_graphics(0,shop_sbar_rect); break; } - + SetFocus(mainPtr); return 0; @@ -609,7 +609,7 @@ return DefWindowProc(hwnd,message,wParam,lParam); void check_game_done() { through_sending(); - + if (All_Done == TRUE) { lose_graphics(); @@ -683,7 +683,7 @@ Boolean handle_menu (short item, HMENU) pick_pc_graphic(choice,1,0); initiate_redraw(); break; - + case 22: choice = select_pc(0,0); if (choice < 6) @@ -691,8 +691,8 @@ Boolean handle_menu (short item, HMENU) put_pc_screen(); put_item_screen(stat_window,0); break; - - + + case 23: if (!(is_town())) { add_string_to_buf("Add PC: Town mode only."); @@ -718,8 +718,8 @@ Boolean handle_menu (short item, HMENU) print_buf(); put_pc_screen(); put_item_screen(stat_window,0); - break; - + break; + case 24: if (prime_time() == FALSE) { ASB("Finish what you're doing first."); @@ -734,8 +734,8 @@ Boolean handle_menu (short item, HMENU) initiate_redraw(); } break; - - case 27: + + case 27: if (overall_mode == MODE_TALKING) { ASB("Talking notes: Can't read while talking."); print_buf(); @@ -798,16 +798,16 @@ Boolean handle_menu (short item, HMENU) party.help_received[9] = FALSE; break; // Priest is 499 - case 499: give_help(209,0,0); + 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; @@ -892,13 +892,13 @@ void change_cursor(POINT where_curs) default: // an arrow SetCursor(arrow_curs[cursor_direction.x + 1][cursor_direction.y + 1]); break; - } + } } void cursor_go() { if (in_startup_mode == TRUE) return; - + if (cursor_shown == TRUE) { cursor_shown = FALSE; diff --git a/Win32/Blades of Exile/boe.newgraph.cpp b/Win32/Blades of Exile/boe.newgraph.cpp index 3e902f76..0e28d4c1 100644 --- a/Win32/Blades of Exile/boe.newgraph.cpp +++ b/Win32/Blades of Exile/boe.newgraph.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -24,7 +24,7 @@ typedef struct { short missile_type; // -1 no miss short path_type,x_adj,y_adj; } store_missile_type; - + typedef struct { location dest; short val_to_place,offset; @@ -32,7 +32,7 @@ typedef struct { short boom_type; // -1 no miss short x_adj,y_adj; } store_boom_type; - + store_missile_type store_missiles[30]; store_boom_type store_booms[30]; Boolean have_missile,have_boom; @@ -62,14 +62,14 @@ void apply_unseen_mask() return; if (!(is_out()) && (c_town.town.lighting > 0)) return; - + for (i = 0; i < 11; i++) - for (j = 0; j < 11; j++) + for (j = 0; j < 11; j++) if (unexplored_area[i + 1][j + 1] == 1) need_bother = TRUE; if (need_bother == FALSE) return; - + hdc = CreateCompatibleDC(main_dc); SetBkMode(hdc,TRANSPARENT); old_brush = (HBRUSH) SelectObject(hdc,checker_brush); @@ -79,7 +79,7 @@ void apply_unseen_mask() store_bmp = (HBITMAP) SelectObject(hdc,terrain_screen_gworld); for (i = 0; i < 11; i++) - for (j = 0; j < 11; j++) + for (j = 0; j < 11; j++) if (unexplored_area[i + 1][j + 1] == 1) { to_rect = base_rect; @@ -93,65 +93,65 @@ void apply_unseen_mask() if ((k >= 0) && (l >= 0) && (k < 9) && (l < 9) && ((k != i - 1) || (l != j - 1))) terrain_there[k][l] = -1; } - + // Now put text on window. SelectObject(hdc,old_brush); SelectObject(hdc,old_pen); SelectObject(hdc,store_bmp); if (!DeleteDC(hdc)) DebugQuit("Cannot release DC 3"); } - -void apply_light_mask() + +void apply_light_mask() { RECT temp = {0,0,84,108},paint_rect,base_rect = {0,0,28,36}; RECT big_to = {13,13,265,337}; /**/ short i,j; Boolean is_dark = FALSE,same_mask = TRUE; - + HDC hdc; HBITMAP store_bmp; HBRUSH old_brush; - + if (PSD[306][2] > 0) return; if (is_out()) return; if (c_town.town.lighting == 0) return; - + if (oval_region == NULL) { temp_rect_rgn = CreateRectRgn(0,0,0,0); dark_mask_region = CreateRectRgn(0,0,0,0); oval_region = CreateEllipticRgnIndirect(&temp); } - + // Process the light array for (i = 2; i < 11; i++) - for (j = 2; j < 11; j++) + for (j = 2; j < 11; j++) if (light_area[i][j] == 0) is_dark = TRUE; - if (is_dark == FALSE) { + if (is_dark == FALSE) { for (i = 2; i < 11; i++) - for (j = 2; j < 11; j++) + for (j = 2; j < 11; j++) last_light_mask[i][j] = 0; return; } for (i = 1; i < 12; i++) for (j = 1; j < 12; j++) - if ((light_area[i - 1][j - 1] >= 1) && (light_area[i + 1][j - 1] >= 1) && - (light_area[i - 1][j] >= 1) && (light_area[i + 1][j] >= 1) && - (light_area[i - 1][j + 1] >= 1) && (light_area[i + 1][j + 1] >= 1) && + if ((light_area[i - 1][j - 1] >= 1) && (light_area[i + 1][j - 1] >= 1) && + (light_area[i - 1][j] >= 1) && (light_area[i + 1][j] >= 1) && + (light_area[i - 1][j + 1] >= 1) && (light_area[i + 1][j + 1] >= 1) && (light_area[i][j - 1] >= 1) && (light_area[i][j + 1] >= 1)) { light_area[i][j] = 2; } for (i = 1; i < 12; i++) for (j = 1; j < 12; j++) - if ((light_area[i - 1][j - 1] >= 2) && (light_area[i + 1][j - 1] >= 2) && - (light_area[i - 1][j] >= 2) && (light_area[i + 1][j] >= 2) && - (light_area[i - 1][j + 1] >= 2) && (light_area[i + 1][j + 1] >= 2) && + if ((light_area[i - 1][j - 1] >= 2) && (light_area[i + 1][j - 1] >= 2) && + (light_area[i - 1][j] >= 2) && (light_area[i + 1][j] >= 2) && + (light_area[i - 1][j + 1] >= 2) && (light_area[i + 1][j + 1] >= 2) && (light_area[i][j - 1] >= 2) && (light_area[i][j + 1] >= 2)) { light_area[i][j] = 3; } - + hdc = CreateCompatibleDC(main_dc); SetBkMode(hdc,TRANSPARENT); store_bmp = (HBITMAP) SelectObject(hdc,terrain_screen_gworld); @@ -163,10 +163,10 @@ void apply_light_mask() terrain_there[i - 2][j - 2] = -1; } for (i = 0; i < 13; i++) - for (j = 0; j < 13; j++) + for (j = 0; j < 13; j++) if (last_light_mask[i][j] != light_area[i][j]) same_mask = FALSE; - + if (same_mask == TRUE) { PaintRgn(hdc,dark_mask_region); SelectObject(hdc,store_bmp); @@ -175,16 +175,16 @@ void apply_light_mask() } SetRectRgn(dark_mask_region,big_to.left,big_to.top,big_to.right,big_to.bottom); for (i = 0; i < 13; i++) - for (j = 0; j < 13; j++) + for (j = 0; j < 13; j++) last_light_mask[i][j] = light_area[i][j]; for (i = 1; i < 12; i++) for (j = 1; j < 12; j++) { if (light_area[i][j] == 2) { - + OffsetRgn(oval_region,13 + 28 * (i - 3), 13 + 36 * (j - 3)); - + CombineRgn(dark_mask_region,dark_mask_region,oval_region,RGN_DIFF); - + OffsetRgn(oval_region,-13 + -1 * (28 * (i - 3)),-13 + -1 * (36 * (j - 3))); } if (light_area[i][j] == 3) { @@ -209,7 +209,7 @@ void apply_light_mask() void start_missile_anim() { short i; - + if (boom_anim_active == TRUE) return; boom_anim_active = TRUE; @@ -217,23 +217,23 @@ void start_missile_anim() store_missiles[i].missile_type = -1; store_booms[i].boom_type = -1; } - for (i = 0; i < 6; i++) + for (i = 0; i < 6; i++) pc_marked_damage[i] = 0; - for (i = 0; i < T_M; i++) + for (i = 0; i < T_M; i++) monst_marked_damage[i] = 0; have_missile = FALSE; have_boom = FALSE; } -void end_missile_anim() +void end_missile_anim() { boom_anim_active = FALSE; } - + void add_missile(location dest,short missile_type,short path_type,short x_adj,short y_adj) { short i; - + if (boom_anim_active == FALSE) return; if (PSD[306][2] > 0) @@ -249,7 +249,7 @@ void add_missile(location dest,short missile_type,short path_type,short x_adj,sh store_missiles[i].missile_type =missile_type; store_missiles[i].path_type =path_type; store_missiles[i].x_adj =x_adj; - store_missiles[i].y_adj =y_adj; + store_missiles[i].y_adj =y_adj; return; } } @@ -271,23 +271,23 @@ void run_a_boom(location boom_where,short type,short x_adj,short y_adj) do_explosion_anim(5,0); end_missile_anim(); } - + void mondo_boom(location l,short type) { short i; - + start_missile_anim(); for (i = 0; i < 12; i++) add_explosion(l,-1,1,type,0,0); do_explosion_anim(5,0); - end_missile_anim(); + end_missile_anim(); } - + void add_explosion(location dest,short val_to_place,short place_type,short boom_type,short x_adj,short y_adj) { short i; - + if (PSD[306][2] > 0) return; if (boom_anim_active == FALSE) @@ -309,21 +309,21 @@ void add_explosion(location dest,short val_to_place,short place_type,short boom_ store_booms[i].place_type = place_type; store_booms[i].boom_type = boom_type; store_booms[i].x_adj =x_adj; - store_booms[i].y_adj =y_adj; + store_booms[i].y_adj =y_adj; return; } -} +} -void do_missile_anim(short num_steps,location missile_origin,short sound_num) +void do_missile_anim(short num_steps,location missile_origin,short sound_num) { RECT temp_rect,missile_origin_base = {1,1,17,17},active_area_rect,to_rect,from_rect; short i,store_missile_dir; POINT start_point,finish_point[30]; location screen_ul; - + short x1[30],x2[30],y1[30],y2[30],t; // for path paramaterization RECT missile_place_rect[30],missile_origin_rect[30],store_erase_rect[30]; - POINT current_terrain_ul; + POINT current_terrain_ul; HBITMAP temp_gworld; long delay_dummy; RECT ter_scrn_rect = {0,0,279,351}; @@ -341,7 +341,7 @@ void do_missile_anim(short num_steps,location missile_origin,short sound_num) boom_anim_active = FALSE; return; } - + for (i = 0; i < 30; i++) if (store_missiles[i].missile_type >= 0) i = 50; @@ -352,15 +352,15 @@ void do_missile_anim(short num_steps,location missile_origin,short sound_num) current_terrain_ul.x = current_terrain_ul.y = 5; - + // make terrain_template contain current terrain all nicely draw_terrain(1); to_rect = ter_scrn_rect; OffsetRect(&to_rect,current_terrain_ul.x, current_terrain_ul.y); rect_draw_some_item(terrain_screen_gworld,ter_scrn_rect, terrain_screen_gworld,to_rect,0,1); - - // create and clip temporary anim template + + // create and clip temporary anim template temp_rect = ter_scrn_rect; temp_gworld = CreateCompatibleBitmap(main_dc,ter_scrn_rect.right,ter_scrn_rect.bottom); active_area_rect = temp_rect; @@ -473,21 +473,21 @@ short get_missile_direction(POINT origin_point,POINT the_point) // so that origin_point is moved to (149,185) and the_point is moved in proportion the_point.x += 149 - origin_point.x; the_point.y += 185 - origin_point.y; - + if ((the_point.x < 135) & (the_point.y >= ((the_point.x * 34) / 10) - 293) & (the_point.y <= (-1 * ((the_point.x * 34) / 10) + 663))) store_dir.x--; if ((the_point.x > 163) & (the_point.y <= ((the_point.x * 34) / 10) - 350) & (the_point.y >= (-1 * ((the_point.x * 34) / 10) + 721))) store_dir.x++; - + if ((the_point.y < 167) & (the_point.y <= (the_point.x / 2) + 102) & (the_point.y <= (-1 * (the_point.x / 2) + 249))) store_dir.y--; if ((the_point.y > 203) & (the_point.y >= (the_point.x / 2) + 123) & (the_point.y >= (-1 * (the_point.x / 2) + 268))) store_dir.y++; - + switch (store_dir.y) { case 0: dir = 4 - 2 * (store_dir.x); break; @@ -495,7 +495,7 @@ short get_missile_direction(POINT origin_point,POINT the_point) dir = (store_dir.x == -1) ? 7 : store_dir.x; break; case 1: dir = 4 - store_dir.x; break; - } + } return dir; } @@ -509,9 +509,9 @@ void do_explosion_anim(short, short special_draw) short i,temp_val,temp_val2; location screen_ul; - - short t,cur_boom_type = 0; - POINT current_terrain_ul; + + short t,cur_boom_type = 0; + POINT current_terrain_ul; HBITMAP temp_gworld; long delay_dummy; short boom_type_sound[3] = {5,10,53}; @@ -528,7 +528,7 @@ void do_explosion_anim(short, short special_draw) boom_anim_active = FALSE; return; } - + for (i = 0; i < 30; i++) if (store_booms[i].boom_type >= 0) i = 50; @@ -538,7 +538,7 @@ void do_explosion_anim(short, short special_draw) // initialize general data current_terrain_ul.x = current_terrain_ul.y = 5; - + // make terrain_template contain current terrain all nicely draw_terrain(1); if (special_draw != 2) { @@ -547,9 +547,9 @@ void do_explosion_anim(short, short special_draw) rect_draw_some_item(terrain_screen_gworld,ter_scrn_rect, terrain_screen_gworld,to_rect,0,1); } - - - // create and clip temporary anim template + + + // create and clip temporary anim template temp_rect = ter_scrn_rect; temp_gworld = CreateCompatibleBitmap(main_dc,ter_scrn_rect.right,ter_scrn_rect.bottom); @@ -557,52 +557,52 @@ void do_explosion_anim(short, short special_draw) SetBkMode(hdc,TRANSPARENT); SelectObject(hdc,small_bold_font); SetTextColor(hdc,colors[4]); - + // init missile paths screen_ul.x = center.x - 4; screen_ul.y = center.y - 4; - for (i = 0; i < 30; i++) + for (i = 0; i < 30; i++) if ((store_booms[i].boom_type >= 0) && (special_draw < 2)) { cur_boom_type = store_booms[i].boom_type; explode_place_rect[i] = base_rect; OffsetRect(&explode_place_rect[i],13 + 28 * (store_booms[i].dest.x - screen_ul.x) + store_booms[i].x_adj, 13 + 36 * (store_booms[i].dest.y - screen_ul.y) + store_booms[i].y_adj); - + if ((store_booms[i].place_type == 1) && (special_draw < 2)) { temp_val = get_ran(1,0,50) - 25; temp_val2 = get_ran(1,0,50) - 25; OffsetRect(&explode_place_rect[i],temp_val,temp_val2); } - - // eliminate stuff that's too gone. + + // eliminate stuff that's too gone. IntersectRect(&temp_rect,&explode_place_rect[i],&ter_scrn_rect); if (EqualRect(&temp_rect,&explode_place_rect[i]) == FALSE) { store_booms[i].boom_type = -1; } - + } else if (special_draw < 2) explode_place_rect[i].top =explode_place_rect[i].left =explode_place_rect[i].bottom =explode_place_rect[i].right = 0; - + if (special_draw < 2) play_sound(boom_type_sound[cur_boom_type]); - + // Now, at last, do explosion for (t = (special_draw == 2) ? 6 : 0; t < ((special_draw == 1) ? 6 : 11); t++) { // t goes up to 10 to make sure screen gets cleaned up // First, lay terrain in temporary graphic area; - for (i = 0; i < 30; i++) - if (store_booms[i].boom_type >= 0) + for (i = 0; i < 30; i++) + if (store_booms[i].boom_type >= 0) rect_draw_some_item(terrain_screen_gworld,explode_place_rect[i], temp_gworld,explode_place_rect[i],0,0); // Now put in explosions - for (i = 0; i < 30; i++) + for (i = 0; i < 30; i++) if (store_booms[i].boom_type >= 0) { if ((t + store_booms[i].offset >= 0) && (t + store_booms[i].offset <= 7)) { from_rect = base_rect; OffsetRect(&from_rect,28 * (t + store_booms[i].offset),144 + 36 * (store_booms[i].boom_type)); rect_draw_some_item(fields_gworld,from_rect, temp_gworld,explode_place_rect[i],1,0); - + if (store_booms[i].val_to_place > 0) { text_rect = explode_place_rect[i]; text_rect.top += 2; @@ -617,7 +617,7 @@ void do_explosion_anim(short, short special_draw) } } // Now draw all missiles to screen - for (i = 0; i < 30; i++) + for (i = 0; i < 30; i++) if (store_booms[i].boom_type >= 0) { to_rect = explode_place_rect[i]; OffsetRect(&to_rect,current_terrain_ul.x,current_terrain_ul.y); @@ -627,9 +627,9 @@ void do_explosion_anim(short, short special_draw) Delay(2 * (1 + PSD[306][6]),&delay_dummy); } - + // Exit gracefully, and clean up screen - for (i = 0; i < 30; i++) + for (i = 0; i < 30; i++) if (special_draw != 1) store_booms[i].boom_type = -1; SelectObject(hdc,store_bmp); @@ -659,11 +659,11 @@ shop_type: void click_shop_rect(RECT area_rect) { long dum; - + draw_shop_graphics(1,area_rect); if (play_sounds == TRUE) play_sound(37); else Delay(5,&dum); - + draw_shop_graphics(0,area_rect); } @@ -671,20 +671,20 @@ void draw_shop_graphics(short draw_mode,RECT clip_area_rect) // mode 1 - drawing dark for button press { RECT area_rect,from_rect,item_info_from = {42,11,56,24}; - + RECT face_rect = {6,6,38,38}; RECT title_rect = {48,15,260,42}; RECT dest_rect,help_from = {126,23,142,36},done_from = {0,23,63,46}; /**/ short faces[13] = {1,1,1,42,43, 1,1,1,1,1, 44,44,44}; - + short i,what_chosen; RECT shopper_name = {6,44,260,56}; short current_pos; - + short cur_cost,what_magic_shop,what_magic_shop_item; char cur_name[256]; char cur_info_str[256]; - char *cost_strs[] = + char *cost_strs[] = { "Extremely Cheap", "Very Reasonable", "Pretty Average", @@ -699,7 +699,7 @@ void draw_shop_graphics(short draw_mode,RECT clip_area_rect) RGB(0,220,0),RGB(255,110,255)}; HBITMAP store_bmp; HBRUSH old_brush; - + hdc = CreateCompatibleDC(main_dc); SetBkMode(hdc,TRANSPARENT); SelectObject(hdc,small_bold_font); @@ -713,7 +713,7 @@ void draw_shop_graphics(short draw_mode,RECT clip_area_rect) OffsetRect(&area_rect,-5,-5); old_brush = (HBRUSH) SelectObject(hdc,GetStockObject(NULL_BRUSH)); - Rectangle(hdc,area_rect.left,area_rect.top,area_rect.right,area_rect.bottom); + Rectangle(hdc,area_rect.left,area_rect.top,area_rect.right,area_rect.bottom); SelectObject(hdc,old_brush); InflateRect(&area_rect,-1,-1); SelectObject(hdc,store_bmp); @@ -723,7 +723,7 @@ void draw_shop_graphics(short draw_mode,RECT clip_area_rect) else paint_pattern(talk_gworld,0,area_rect,3); SelectObject(hdc,talk_gworld); - + old_brush = (HBRUSH) SelectObject(hdc,GetStockObject(NULL_BRUSH)); Rectangle(hdc,shop_frame.left,shop_frame.top,shop_frame.right,shop_frame.bottom); SelectObject(hdc,old_brush); @@ -850,7 +850,7 @@ void draw_shop_graphics(short draw_mode,RECT clip_area_rect) char_win_draw_string(hdc,bottom_help_rects[2],"Hit done button (or Esc.) to quit.",0,12); if ((store_shop_type != 3) && (store_shop_type != 4)) char_win_draw_string(hdc,bottom_help_rects[3],"'I' button brings up description.",0,12); - + SelectObject(hdc,store_bmp); if (!DeleteDC(hdc)) DebugQuit("Cannot release DC 8"); @@ -863,7 +863,7 @@ void refresh_shopping() RECT from_rects[4] = {{0,0,279,62},{0,62,253,352},{269,62,279,352},{0,352,279,415}},to_rect; /**/ short i; - + for (i = 0; i < 4; i++) { to_rect = from_rects[i]; OffsetRect(&to_rect,5,5); @@ -883,17 +883,17 @@ void click_talk_rect(char *str_to_place,char *str_to_place2,RECT c_rect) place_talk_str(str_to_place,str_to_place2,0,c_rect); } -item_record_type store_mage_spells(short which_s) +item_record_type store_mage_spells(short which_s) { item_record_type spell = {21,0, 0,0,0,0,0,0, 53,0,0,0,0,0, 0, 0,0, location(),"", "",0,0,0,0}; short cost[32] = {150,200,150,1000,1200,400,300,200, - 200,250,500,1500,300, 250,125,150, + 200,250,500,1500,300, 250,125,150, 400,450, 800,600,700,600,7500, 500, 5000,3000,3500,4000,4000,4500,7000,5000}; char str[256]; - + if (which_s != minmax(0,31,(int)which_s)) which_s = 0; spell.item_level = which_s + 30; @@ -928,14 +928,14 @@ item_record_type store_alchemy(short which_s) item_record_type spell = {21,0, 0,0,0,0,0,0, 53,0,0,0,0,0, 0, 0,0, location(),"", "",0,0,0,0}; short val[20] = {50,75,30,130,100,150, 200,200,300,250,300, 500,600,750,700,1000,10000,5000,7000,12000}; char str[256]; - + if (which_s != minmax(0,19,(int)which_s)) which_s = 0; spell.item_level = which_s; spell.value = val[which_s]; GetIndString(str,38,which_s + 100); strcpy((char *)spell.full_name,(char *)str); - return spell; + return spell; } void get_item_interesting_string(item_record_type item,char *message) @@ -978,11 +978,11 @@ void get_item_interesting_string(item_record_type item,char *message) sprintf(message,"Poison: Does %d-%d damage.",item.item_level,item.item_level * 6); break; default: - sprintf(message,""); + sprintf(message,""); if (item.charges > 0) - sprintf(message,"Uses: %d",item.charges); + sprintf(message,"Uses: %d",item.charges); break; - } + } if (item.charges > 0) sprintf(message,"Uses: %d",item.charges); } @@ -992,7 +992,7 @@ void place_talk_str(char *str_to_place,char *str_to_place2,short color,RECT c_re // color 0 - regular 1 - darker { RECT area_rect; - + RECT face_rect = {6,6,38,38}; RECT title_rect = {48,19,260,42}; RECT dest_rect,help_from = {126,23,142,36}; /**/ @@ -1003,7 +1003,7 @@ void place_talk_str(char *str_to_place,char *str_to_place2,short color,RECT c_re short last_line_break = 0,last_word_break = 0,on_what_line = 0,last_stored_word_break = 0; Boolean force_skip = FALSE; short face_to_draw; - + HDC hdc; COLORREF colors[7] = {RGB(0,0,0),RGB(0,0,204),RGB(0,0,102),RGB(0,0,100),RGB(0,0,220), RGB(51,153,51),RGB(0,204,0)}; @@ -1033,7 +1033,7 @@ void place_talk_str(char *str_to_place,char *str_to_place2,short color,RECT c_re paint_pattern(talk_gworld,0,c_rect,3); } else paint_pattern(talk_gworld,0,area_rect,3); - + // Put help button talk_help_rect.right = talk_help_rect.left + help_from.right - help_from.left; talk_help_rect.bottom = talk_help_rect.top + help_from.bottom - help_from.top; @@ -1105,18 +1105,18 @@ void place_talk_str(char *str_to_place,char *str_to_place2,short color,RECT c_re for (i = 0;i < str_len;i++) { if (((str[i] != 39) && ((str[i] < 65) || (str[i] > 122)) && ((str[i] < 48) || (str[i] > 57))) && (color == 0)) { // New word, so set up a rect - if (((i - store_last_word_break >= 4) || (i >= str_len - 1)) + if (((i - store_last_word_break >= 4) || (i >= str_len - 1)) && (i - last_stored_word_break >= 4) && (talk_end_forced == FALSE)) { store_words[current_rect].word_rect.left = dest_rect.left + (text_len[store_last_word_break] - text_len[last_line_break]) - 2; store_words[current_rect].word_rect.right = dest_rect.left + (text_len[i + 1] - text_len[last_line_break]) - 1; store_words[current_rect].word_rect.top = dest_rect.top + 1 + line_height * on_what_line - 5; store_words[current_rect].word_rect.bottom = dest_rect.top + 1 + line_height * on_what_line + 13; - if ((str[store_last_word_break] < 48) || (str[store_last_word_break] == 96) + if ((str[store_last_word_break] < 48) || (str[store_last_word_break] == 96) || (str[store_last_word_break] > 122) || ((str[store_last_word_break] >= 58) && (str[store_last_word_break] <= 64))) store_last_word_break++; - + store_words[current_rect].word[0] = str[store_last_word_break]; store_words[current_rect].word[1] = str[store_last_word_break + 1]; store_words[current_rect].word[2] = str[store_last_word_break + 2]; @@ -1136,7 +1136,7 @@ void place_talk_str(char *str_to_place,char *str_to_place2,short color,RECT c_re last_stored_word_break = i + 1; } } - if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) + if (((text_len[i] - text_len[last_line_break] > (dest_rect.right - dest_rect.left - 6)) && (last_word_break > last_line_break)) || (str[i] == '|') || (i == str_len - 1)) { if (str[i] == '|') { str[i] = ' '; @@ -1242,7 +1242,7 @@ void place_talk_str(char *str_to_place,char *str_to_place2,short color,RECT c_re last_word_break++; } if ((start_of_last_kept_word >= last_line_break) && (current_rect > 0)) { - OffsetRect(&store_words[current_rect - 1].word_rect,5 + -1 * store_words[current_rect - 1].word_rect.left,line_height); + OffsetRect(&store_words[current_rect - 1].word_rect,5 + -1 * store_words[current_rect - 1].word_rect.left,line_height); } } if (str[i] == ' ') { // New word @@ -1253,13 +1253,13 @@ void place_talk_str(char *str_to_place,char *str_to_place2,short color,RECT c_re } } - + SelectObject(hdc,store_bmp); SelectObject(hdc,store_font); if (!DeleteDC(hdc)) DebugQuit("Cannot release DC 7"); refresh_talking(); - + // Clean up strings for (i = 0; i < 50; i++) for (j = 0; j < 4; j++) @@ -1280,14 +1280,14 @@ short scan_for_response(char *str) // returns -1 if no go { short i; - + for (i = 0; i < 60; i++) { // 60 response in each bunch if ((talking.talk_nodes[i].personality != -1) && ((talking.talk_nodes[i].personality == store_personality) - || (talking.talk_nodes[i].personality == -2)) && - (((str[0] == talking.talk_nodes[i].link1[0]) && (str[1] == talking.talk_nodes[i].link1[1]) - && (str[2] == talking.talk_nodes[i].link1[2]) && (str[3] == talking.talk_nodes[i].link1[3])) - || ((str[0] == talking.talk_nodes[i].link2[0]) && (str[1] == talking.talk_nodes[i].link2[1]) + || (talking.talk_nodes[i].personality == -2)) && + (((str[0] == talking.talk_nodes[i].link1[0]) && (str[1] == talking.talk_nodes[i].link1[1]) + && (str[2] == talking.talk_nodes[i].link1[2]) && (str[3] == talking.talk_nodes[i].link1[3])) + || ((str[0] == talking.talk_nodes[i].link2[0]) && (str[1] == talking.talk_nodes[i].link2[1]) && (str[2] == talking.talk_nodes[i].link2[2]) && (str[3] == talking.talk_nodes[i].link2[3])))) return i; } diff --git a/Win32/Blades of Exile/classes/LOCATION.CPP b/Win32/Blades of Exile/classes/location.cpp similarity index 100% rename from Win32/Blades of Exile/classes/LOCATION.CPP rename to Win32/Blades of Exile/classes/location.cpp diff --git a/Win32/Blades of Exile/classes/LOCATION.H b/Win32/Blades of Exile/classes/location.h similarity index 100% rename from Win32/Blades of Exile/classes/LOCATION.H rename to Win32/Blades of Exile/classes/location.h diff --git a/Win32/Blades of Exile/classes/PC.CPP b/Win32/Blades of Exile/classes/pc.cpp similarity index 100% rename from Win32/Blades of Exile/classes/PC.CPP rename to Win32/Blades of Exile/classes/pc.cpp diff --git a/Win32/Blades of Exile/classes/PC.H b/Win32/Blades of Exile/classes/pc.h similarity index 100% rename from Win32/Blades of Exile/classes/PC.H rename to Win32/Blades of Exile/classes/pc.h diff --git a/Win32/Blades of Exile/GLOBAL.CPP b/Win32/Blades of Exile/global.cpp similarity index 100% rename from Win32/Blades of Exile/GLOBAL.CPP rename to Win32/Blades of Exile/global.cpp diff --git a/Win32/Blades of Exile/GLOBAL.H b/Win32/Blades of Exile/global.h similarity index 100% rename from Win32/Blades of Exile/GLOBAL.H rename to Win32/Blades of Exile/global.h diff --git a/Win32/Blades of Exile/GLOBVAR.CPP b/Win32/Blades of Exile/globvar.cpp similarity index 100% rename from Win32/Blades of Exile/GLOBVAR.CPP rename to Win32/Blades of Exile/globvar.cpp diff --git a/Win32/Blades of Exile/GLOBVAR.H b/Win32/Blades of Exile/globvar.h similarity index 100% rename from Win32/Blades of Exile/GLOBVAR.H rename to Win32/Blades of Exile/globvar.h diff --git a/Win32/Blades of Exile/tools/DLOGTOOL.CPP b/Win32/Blades of Exile/tools/dlogtool.cpp similarity index 95% rename from Win32/Blades of Exile/tools/DLOGTOOL.CPP rename to Win32/Blades of Exile/tools/dlogtool.cpp index e88d593f..d0e4541e 100644 --- a/Win32/Blades of Exile/tools/DLOGTOOL.CPP +++ b/Win32/Blades of Exile/tools/dlogtool.cpp @@ -22,7 +22,7 @@ struct Dialog HWND parent; short highest_item; Boolean draw_ready; - + Dialog() : key(-1), type(0), handle(NULL), highest_item(0) { } } dialogs[ND]; */ @@ -65,7 +65,7 @@ void cd_init_dialogs() } for (i = 0; i < NI; i++) item_dlg[i] = -1; for (i = 0; i < NL; i++) label_taken[i] = FALSE; - + d_proc = dummy_dialog_proc; edit_proc = fresh_edit_proc; } @@ -105,7 +105,7 @@ long CALLBACK fresh_edit_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa break; } } - + return CallWindowProc((WNDPROC) old_edit_proc,hwnd,message,wParam,lParam); } @@ -135,18 +135,18 @@ short cd_create_custom_pic_dialog(HWND parent, HBITMAP picture) return -1; } GetObject(picture, sizeof(bitmap_info), &bitmap_info); - + GetClientRect(mainPtr, &c_rect); - + if(bitmap_info.bmWidth > c_rect.right) bitmap_info.bmWidth = c_rect.right; - + if(bitmap_info.bmHeight > c_rect.bottom) bitmap_info.bmHeight = c_rect.bottom - 60; pic_rect.right = bitmap_info.bmWidth; pic_rect.bottom = bitmap_info.bmHeight; - + store_dlog_num = 905; for (i = 0; i < ND; i++) { @@ -210,28 +210,28 @@ short cd_create_custom_pic_dialog(HWND parent, HBITMAP picture) item_key[free_item] = 31; but_items = free_item; // remember this to set item rect later cur_item++; - + item_rect[but_items].right = bitmap_info.bmWidth - 10; item_rect[but_items].left = item_rect[but_items].right - 63; item_rect[but_items].top = bitmap_info.bmHeight + 5; item_rect[but_items].bottom = item_rect[but_items].top + 23; - + for (j = 150; j < NI; j++) if (item_dlg[j] < 0) { free_item = j; j = NI + 1; } - item_dlg[free_item] = store_dlog_num; + item_dlg[free_item] = store_dlog_num; item_number[free_item] = cur_item; item_type[free_item] = 20; //draw loaded picture - item_active[free_item] = 1; - cur_item++; + item_active[free_item] = 1; + cur_item++; dlg_highest_item[free_slot] = cur_item - 1; - + center_window(dlgs[free_slot]); ShowWindow(dlgs[free_slot],SW_SHOW); - + if (dlg_parent[free_slot] != NULL) { EnableWindow(dlg_parent[free_slot],FALSE); if (dlg_parent[free_slot] == mainPtr) @@ -401,7 +401,7 @@ short cd_create_custom_dialog(HWND parent, (char *) strs[i]); cur_item++; } - + dlg_highest_item[free_slot] = cur_item - 1; // finally, do button rects @@ -420,14 +420,14 @@ short cd_create_custom_dialog(HWND parent, win_width = item_rect[but_items[i]].right + 6; win_height = item_rect[but_items[i]].bottom + 6; } - } - + } + win_height += 18; MoveWindow(dlgs[free_slot],0,0,win_width,win_height,FALSE); center_window(dlgs[free_slot]); ShowWindow(dlgs[free_slot],SW_SHOW); - + if (dlg_parent[free_slot] != NULL) { EnableWindow(dlg_parent[free_slot],FALSE); if (dlg_parent[free_slot] == mainPtr) @@ -451,9 +451,9 @@ short cd_create_dialog(short dlog_num, HWND parent) store_dlog_num = dlog_num; store_parent = parent; - for (i = 0; i < ND; i++) + for (i = 0; i < ND; i++) if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) return -1; - + for (i = 0; i < ND; i++) { if (dlg_keys[i] < 0) { free_slot = i; @@ -461,9 +461,9 @@ short cd_create_dialog(short dlog_num, HWND parent) } } if (free_slot < 0) return -2; - + current_key++; - + dlg_keys[free_slot] = current_key; dlg_types[free_slot] = dlog_num; dlg_highest_item[free_slot] = 1; @@ -472,7 +472,7 @@ short cd_create_dialog(short dlog_num, HWND parent) // first, create dummy dlog store_free_slot = free_slot; - + dlg = CreateDialog( (HINSTANCE) store_hInstance, MAKEINTRESOURCE(dlog_num), @@ -486,7 +486,7 @@ short cd_create_dialog(short dlog_num, HWND parent) DebugQuit("Couldn't create Dialog Box"); return -3; } - + center_window(dlgs[free_slot]); dlg_parent[free_slot] = parent; @@ -525,14 +525,14 @@ short cd_create_dialog(short dlog_num, HWND parent) case 1100: SetWindowText(dlgs[free_slot],"Compatibility Options"); break; default: SetWindowText(dlgs[free_slot],"Blades of Exile"); break; } - + ShowWindow(dlgs[free_slot],SW_SHOW); DestroyWindow(dlg); //Necessary? Dunno. if (dlg_parent[free_slot] != NULL) { EnableWindow(dlg_parent[free_slot], FALSE); - + if (dlg_parent[free_slot] == mainPtr) for (i = 0; i < 18; i++) if (modeless_exists[i] == TRUE) EnableWindow(modeless_dialogs[i],FALSE); @@ -570,7 +570,7 @@ BOOL CALLBACK dummy_dialog_proc (HWND hDlg, UINT message, WPARAM, LPARAM) NULL, store_hInstance, NULL); - + // Now, give the window its items for (i = 0; i < 200; i++) if (GetDlgItem(hDlg,i) != NULL) @@ -579,7 +579,7 @@ BOOL CALLBACK dummy_dialog_proc (HWND hDlg, UINT message, WPARAM, LPARAM) str_offset = 1; dlg_highest_item[free_slot] = i; str_stored = FALSE; - + if (strlen((char *)item_str) == 0) { sprintf((char *) item_str, "+"); @@ -624,7 +624,7 @@ BOOL CALLBACK dummy_dialog_proc (HWND hDlg, UINT message, WPARAM, LPARAM) str_stored = TRUE; } else sscanf(item_str,"%d_%d",&type,&flag); - + free_item = -1; // find free item switch (type) { @@ -653,37 +653,37 @@ BOOL CALLBACK dummy_dialog_proc (HWND hDlg, UINT message, WPARAM, LPARAM) } break; } - + if (free_item >= 0) { item_dlg[free_item] = store_dlog_num; item_type[free_item] = type; item_number[free_item] = i; - + item_rect[free_item] = get_item_rect(hDlg,i); item_rect[free_item].top = item_rect[free_item].top / 2; item_rect[free_item].left = item_rect[free_item].left / 2; item_rect[free_item].bottom = item_rect[free_item].bottom / 2; item_rect[free_item].right = item_rect[free_item].right / 2; - + if ((type != 5) && ((store_dlog_num >= 2000) || (store_dlog_num == 986))) { item_rect[free_item].top = (item_rect[free_item].top * 11) / 10; item_rect[free_item].bottom = (item_rect[free_item].bottom * 11) / 10; } - + item_flag[free_item] = flag; item_active[free_item] = 1; item_label[free_item] = 0; item_label_loc[free_item] = -1; item_key[free_item] = 0; - + switch (type) { case 0: case 1: if (item_flag[free_item] != 143) { item_rect[free_item].right = item_rect[free_item].left + button_width[button_type[flag]]; item_rect[free_item].bottom = item_rect[free_item].top + button_height[button_type[flag]]; - + item_key[free_item] = button_def_key[flag]; if (type == 1) item_key[free_item] = 31; @@ -738,8 +738,8 @@ BOOL CALLBACK dummy_dialog_proc (HWND hDlg, UINT message, WPARAM, LPARAM) MoveWindow(dlgs[free_slot],0,0,win_width,win_height,FALSE); EndDialog(hDlg, 0); return TRUE; - } /* end of switch */ - + } /* end of switch */ + return TRUE; } @@ -750,7 +750,7 @@ short cd_kill_dialog(short dlog_num,short parent_message) for (i = 0; i < ND; i++) if ((dlg_keys[i] >= 0) && (dlg_types[i] == dlog_num)) which_dlg = i; - + if (which_dlg < 0) return -1; @@ -792,14 +792,14 @@ short cd_process_click(HWND window, POINT the_point, WPARAM wparam, LPARAM,short short i,which_dlg,dlg_num,item_id; short dlog_key; // char dummy[256]; - + if ((which_dlg = cd_find_dlog(window,&dlg_num,&dlog_key)) < 0) return -1; - + for (i = 0; i < dlg_highest_item[which_dlg] + 1; i++) { if ((item_id = cd_get_item_id(dlg_num,i)) >= 0) - { + { if (PtInRect(&item_rect[item_id],the_point) && (item_active[item_id] > 0) && ((item_type[item_id] < 3) || (item_type[item_id] == 8) || (item_type[item_id] == 10)|| (item_type[item_id] == 11))) @@ -811,7 +811,7 @@ short cd_process_click(HWND window, POINT the_point, WPARAM wparam, LPARAM,short } } } - + return -1; } @@ -1111,7 +1111,7 @@ void cd_draw_item(short dlog_num,short item_num) return; if (dlg_draw_ready[dlg_index] == FALSE) return; - + win_dc = cd_get_dlog_dc(dlg_index); old_font = (HFONT) SelectObject(win_dc,small_bold_font); dlg_force_dc = win_dc; @@ -1202,19 +1202,19 @@ void cd_draw_item(short dlog_num,short item_num) from_rect.right = bitmap_info.bmWidth; from_rect.bottom = bitmap_info.bmHeight; - + GetObject(displayed_picture, sizeof(bitmap_info), &bitmap_info); //is picture greater ... hdc = CreateCompatibleDC(NULL); //let's draw the picture SelectObject(hdc, displayed_picture); if((from_rect.right != bitmap_info.bmWidth) || (from_rect.bottom != bitmap_info.bmHeight)){ // ... than the screen ? - StretchBlt(win_dc,0, 0, from_rect.right, from_rect.bottom, hdc, 0 ,0 , bitmap_info.bmWidth, bitmap_info.bmHeight, SRCCOPY); + StretchBlt(win_dc,0, 0, from_rect.right, from_rect.bottom, hdc, 0 ,0 , bitmap_info.bmWidth, bitmap_info.bmHeight, SRCCOPY); bitmap_info.bmWidth = from_rect.right; //in case of redraw ... bitmap_info.bmHeight = from_rect.bottom; //... put back the screen max values } else BitBlt(win_dc,0, 0, from_rect.right, from_rect.bottom, hdc, 0 ,0 , SRCCOPY); - + DeleteDC(hdc); //clean after drawing //careful with the graphic files, if streched the quality can drop significantly. } @@ -1385,7 +1385,7 @@ void cd_erase_item(short dlog_num, short item_num) return; win_dc = cd_get_dlog_dc(dlg_index); paint_pattern((HBITMAP) win_dc,2,to_fry,0); - cd_kill_dc(dlg_index,win_dc); + cd_kill_dc(dlg_index,win_dc); } void cd_press_button(short dlog_num, short item_num) @@ -1411,7 +1411,7 @@ void cd_press_button(short dlog_num, short item_num) from_rect.bottom = from_rect.top + button_height[button_type[item_flag[item_index]]]; from_rect.right = from_rect.left + button_width[button_type[item_flag[item_index]]]; OffsetRect(&from_rect,button_width[button_type[item_flag[item_index]]],0); - + rect_draw_some_item(dlg_buttons_gworld,from_rect,(HBITMAP)win_dc,item_rect[item_index],0,2); SelectObject(win_dc,bold_font); @@ -1424,7 +1424,7 @@ void cd_press_button(short dlog_num, short item_num) } else { char_win_draw_string(win_dc,item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : + (char *) ((item_index < 10) ? text_long_str[item_index] : text_short_str[item_index - 10]),1,8); } if (item_type[item_index] < 2) @@ -1449,7 +1449,7 @@ void cd_press_button(short dlog_num, short item_num) } else { char_win_draw_string(win_dc,item_rect[item_index], - (char *) ((item_index < 10) ? text_long_str[item_index] : + (char *) ((item_index < 10) ? text_long_str[item_index] : text_short_str[item_index - 10]),1,8); } if (item_type[item_index] < 2) @@ -1560,7 +1560,7 @@ void frame_dlog_rect(HWND hDlg, RECT rect, short val) keep_dc = TRUE; } else hdc = GetDC(hDlg); - + if (hdc == NULL) { beep(); @@ -1595,8 +1595,8 @@ void draw_dialog_graphic(HWND hDlg, RECT rect, short which_g, Boolean do_frame,s // 900 + x B&W graphic // 950 null item // 1000 + x Talking face -// 1100 - item info help -// 1200 - pc screen help +// 1100 - item info help +// 1200 - pc screen help // 1300 - combat ap // 1400-1402 - button help // 1500 - stat symbols help @@ -1609,7 +1609,7 @@ void draw_dialog_graphic(HWND hDlg, RECT rect, short which_g, Boolean do_frame,s RECT face_from = {0,0,32,32}; RECT to_rect = {6,6,42,42}; // RECT bw_from = {0,0,120,120}; - + RECT pc_info_from = {0,127,106,157}; RECT item_info_from = {174,0,312,112}; RECT button_help_from = {0,0,320,100}; @@ -1836,14 +1836,14 @@ void draw_dialog_graphic(HWND hDlg, RECT rect, short which_g, Boolean do_frame,s rect_draw_some_item(talking_portraits_gworld,from_rect,(HBITMAP) hDlg,rect,0,0); else rect_draw_some_item(talking_portraits_gworld,from_rect,(HBITMAP)hdc,rect,0,draw_dest); break; - case 11: // item info help + case 11: // item info help from_rect = item_info_from; rect.right = rect.left + from_rect.right - from_rect.left; rect.bottom = rect.top + from_rect.bottom - from_rect.top; rect_draw_some_item(mixed_gworld,from_rect,(HBITMAP) ((win_or_gworld == 1) ? (HBITMAP)hDlg: (HBITMAP)hdc) ,rect,0,draw_dest); break; - case 12: // item info help + case 12: // item info help from_rect = pc_info_from; rect.right = rect.left + pc_info_from.right - pc_info_from.left; rect.bottom = rect.top + pc_info_from.bottom - pc_info_from.top; @@ -1871,7 +1871,7 @@ void draw_dialog_graphic(HWND hDlg, RECT rect, short which_g, Boolean do_frame,s ,rect,0,draw_dest); DeleteObject(from_gworld); break; - case 13: // combat ap help + case 13: // combat ap help from_gworld = load_pict(1402,main_dc); from_rect = combat_ap_from; rect.right = rect.left + from_rect.right; @@ -1880,7 +1880,7 @@ void draw_dialog_graphic(HWND hDlg, RECT rect, short which_g, Boolean do_frame,s ,rect,0,draw_dest); DeleteObject(from_gworld); break; - case 15: // stat symbols help + case 15: // stat symbols help from_gworld = load_pict(1400,main_dc); from_rect = stat_symbols_from; rect.right = rect.left + from_rect.right; @@ -1889,7 +1889,7 @@ void draw_dialog_graphic(HWND hDlg, RECT rect, short which_g, Boolean do_frame,s ,rect,0,draw_dest); DeleteObject(from_gworld); break; - case 16: + case 16: which_g -= 1600; from_gworld = load_pict(851,main_dc); from_rect.right = 32; diff --git a/Win32/Blades of Exile/tools/DLOGTOOL.H b/Win32/Blades of Exile/tools/dlogtool.h similarity index 100% rename from Win32/Blades of Exile/tools/DLOGTOOL.H rename to Win32/Blades of Exile/tools/dlogtool.h