From 1cda877ad6bcdf23b0b3e8fb80d488db4d99be9c Mon Sep 17 00:00:00 2001 From: Chokboyz Date: Sun, 20 Sep 2009 15:21:58 +0000 Subject: [PATCH] Blades of Exile : *SDF[0][x] can now be set/checked by using the "Set SDF" debug command (Shift-S). Scenario Editor : *Implemented Ishad Nha's "Concise Town report" function (accessible under Town Advanced). Chokboyz git-svn-id: http://openexile.googlecode.com/svn/trunk@127 4ebdad44-0ea0-11de-aab3-ff745001d230 --- Win32/Blades of Exile/boe.actions.cpp | 6 +- Win32/Scenario Editor/BLSCENED.CPP | 4 + Win32/Scenario Editor/BLSCENED.RC | 1 + Win32/Scenario Editor/GAMEDLOG.RC | 27 ++++-- Win32/Scenario Editor/TFILEIO.CPP | 114 ++++++++++++++++++++++++++ Win32/Scenario Editor/TFILEIO.H | 1 + 6 files changed, 141 insertions(+), 12 deletions(-) diff --git a/Win32/Blades of Exile/boe.actions.cpp b/Win32/Blades of Exile/boe.actions.cpp index 27e2af89..ee6daa3f 100644 --- a/Win32/Blades of Exile/boe.actions.cpp +++ b/Win32/Blades of Exile/boe.actions.cpp @@ -1855,13 +1855,13 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam) print_buf(); } break; - case 'S': // Set a SDF <= can't set the SDF 0 (it's the default return value if the first character of the string is not a number) + case 'S': // Set a SDF if (in_scen_debug) { //and leave alone the 300+ SDF (game options/mechanics) char response[256]=""; - display_strings("Enter Stuff Done Flag Part A (between 1 and 299)","",0,0,0,0,"Which SDFa ?",-1,130,0); + display_strings("Enter Stuff Done Flag Part A (between 0 and 299)","",0,0,0,0,"Which SDFa ?",-1,130,0); get_text_response(873,response,0); i = atoi(response); - if(i>0 && i <300){ + if(i >= 0 && i <300){ display_strings("Enter Stuff Done Flag Part B (between 0 and 9)","",0,0,0,0,"Which SDFb ?",-1,130,0); get_text_response(873,response,0); j = atoi(response); diff --git a/Win32/Scenario Editor/BLSCENED.CPP b/Win32/Scenario Editor/BLSCENED.CPP index b18901fb..7ca7be3e 100644 --- a/Win32/Scenario Editor/BLSCENED.CPP +++ b/Win32/Scenario Editor/BLSCENED.CPP @@ -710,6 +710,10 @@ Boolean handle_menu (short item, HMENU menu) } break; + case 221: if (fancy_choice_dialog(877,0) == 1) // make concise town report + start_town_data_dump(); + break; + // Outdoor Menu case 301: outdoor_details(); break; case 302: edit_out_wand(0); break; diff --git a/Win32/Scenario Editor/BLSCENED.RC b/Win32/Scenario Editor/BLSCENED.RC index 06ce800e..cd74c786 100644 --- a/Win32/Scenario Editor/BLSCENED.RC +++ b/Win32/Scenario Editor/BLSCENED.RC @@ -76,6 +76,7 @@ Exile MENU MENUITEM " Edit Town Text", 214 MENUITEM " Advanced Town Details", 215 MENUITEM " Set Town Event Timers", 216 + MENUITEM " Concise Town Report",221 MENUITEM SEPARATOR MENUITEM " Clear All Monsters", 217 MENUITEM " Clear All Placed Specials", 218 diff --git a/Win32/Scenario Editor/GAMEDLOG.RC b/Win32/Scenario Editor/GAMEDLOG.RC index 061c456d..81882888 100644 --- a/Win32/Scenario Editor/GAMEDLOG.RC +++ b/Win32/Scenario Editor/GAMEDLOG.RC @@ -1873,16 +1873,25 @@ STYLE WS_POPUP | WS_DLGFRAME LTEXT "This option erases all preset stains in the town. Go ahead?" 4, 49, 6, 258, 32 } +877 DIALOG 10, 10, 356, 154 + STYLE WS_POPUP | WS_DLGFRAME + { + LTEXT "1_63", 1, 254, 129, 66, 20 + LTEXT "0_5", 2, 189, 129, 65, 20 + LTEXT "5_716", 3, 6, 6, 36, 36 + LTEXT "Lists of all the placed specials, signs, items and fields in the current town are about to be put into a file called 'BoE Concise Town Report.txt' in the editor folder. You can then use this file as a handy reference while designing your scenario.", 4, 49, 6, 271, 66 + LTEXT "It includes the locations and text strings too.", 5, 49, 95, 271, 29 + } + 890 DIALOG 10, 10, 357, 114 -STYLE WS_POPUP | WS_DLGFRAME -{ - LTEXT "1_63", 1, 255, 89, 66, 20 - LTEXT "0_5", 2, 190, 89, 65, 20 - LTEXT "5_716", 3, 6, 6, 36, 36 - LTEXT "This produces a list of all specials related things in your scenario and writes them into a file called 'Specdata.txt' in the editor folder. Be warned though, that can take a long time...", 4, 49, 6, 271, 66 - -} - + STYLE WS_POPUP | WS_DLGFRAME + { + LTEXT "1_63", 1, 255, 89, 66, 20 + LTEXT "0_5", 2, 190, 89, 65, 20 + LTEXT "5_716", 3, 6, 6, 36, 36 + LTEXT "This produces a list of all specials related things in your scenario and writes them into a file called 'Specdata.txt' in the editor folder. Be warned though, that can take a long time...", 4, 49, 6, 271, 66 + } + 970 DIALOG 10, 10, 346, 167 STYLE WS_POPUP | WS_DLGFRAME { diff --git a/Win32/Scenario Editor/TFILEIO.CPP b/Win32/Scenario Editor/TFILEIO.CPP index 0e82dd8c..323b0806 100644 --- a/Win32/Scenario Editor/TFILEIO.CPP +++ b/Win32/Scenario Editor/TFILEIO.CPP @@ -62,6 +62,8 @@ SCROLLINFO lpsi; OFSTRUCT store; Boolean suppress_load_file_name = FALSE; +char *field_names[22] = {"Blank","Unknown","Unknown","Web","Crate","Barrel","Fire Barrier","Force Barrier","Quickfire","Unknown","Unknown","Unknown","Unknown","Unknown","Small Blood Stain","Medium Blood Stain","Large Blood Stain","Small Slime Pool","Large Slime Pool","Ash","Bones","Rocks"}; + void print_write_position (); void Get_Path(char* path){ @@ -1209,6 +1211,118 @@ void oops_error(short error) PostQuitMessage(0); } +void start_town_data_dump() +{ + short i; + HANDLE data_dump_file_id; + DWORD dwByteRead; + char get_text[280], spec_name[256]; + + data_dump_file_id = CreateFile("BoE Concise Town Report.txt", GENERIC_WRITE, FILE_SHARE_READ, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + + if (data_dump_file_id == INVALID_HANDLE_VALUE) + { + oops_error(28); + beep(); + return; + } + + sprintf(get_text,"\r\rConcise Town Data Printout for town %d, %s\r\r",cur_town,town_strs[0]); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + sprintf(get_text," For rectangles: \"tl\" = the top and left corner of the rectangle while \"br\" = the bottom and right corner.\r\r Maximum number of any given type of town object is shown by \"[ # ]\".\rNull objects are frequently not listed."); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + + sprintf(get_text,"\r\r In town rectangle: tl = (%d,%d), br = (%d,%d)\r",town.in_town_rect.left,town.in_town_rect.top,town.in_town_rect.right,town.in_town_rect.bottom); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + + sprintf(get_text,"\r\r Town Placed Specials: [50]\r"); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + + for (i = 0; i < 50; i++) { + if (town.spec_id[i] < 255){ + get_str(spec_name,22,town.specials[town.spec_id[i]].type + 1); + sprintf(get_text," Placed special %d: x = %d, y = %d, state = %d, name = %s\r",i,town.special_locs[i].x,town.special_locs[i].y,town.spec_id[i],spec_name); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + } + } + sprintf(get_text,"\r\r Town Signs: [15]\r"); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + + for (i = 0; i < 15; i++) { + sprintf(get_text," Town Sign %d: x = %d, y = %d, text: \"%s\"\r",i,town.sign_locs[i].x,town.sign_locs[i].y,town_strs[120 + i]); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + } + + sprintf(get_text,"\r\r Town Preset Items: [64]\r"); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + + for (i = 0; i < 64; i++) { + if (town.preset_items[i].item_code > 0) { + sprintf(get_text," Item %d: type = %d, x,y = (%d,%d), charges = %d, properties = %d, contained = %d, name = %s\r",i,town.preset_items[i].item_code,town.preset_items[i].item_loc.x,town.preset_items[i].item_loc.y,town.preset_items[i].charges,town.preset_items[i].property,town.preset_items[i].contained,scen_item_list.scen_items[town.preset_items[i].item_code].full_name); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + } + } + + sprintf(get_text,"\r\r Town Preset Fields: [50]\r"); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + + for (i = 0; i < 50; i++) { + if (town.preset_fields[i].field_type > 0) { + sprintf(get_text," Preset field %d: x = %d, y = %d, type = %d, name = %s\r",i,town.preset_fields[i].field_loc.x,town.preset_fields[i].field_loc.y,town.preset_fields[i].field_type,field_names[town.preset_fields[i].field_type]); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + } + } + + switch(scenario.town_size[cur_town]){ + case 0: + sprintf(get_text,"\r\r Big Town Creatures [60]: type number > 0\r"); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + for (i = 0; i < 60; i++) { + if (t_d.creatures[i].number > 0) { + sprintf(get_text," Creature %d: x = %d, y = %d, type = %d, attitude = %d, hidden class = %d, name = %s\r",i,t_d.creatures[i].start_loc.x,t_d.creatures[i].start_loc.y,t_d.creatures[i].number,t_d.creatures[i].start_attitude,t_d.creatures[i].spec_enc_code,scen_item_list.monst_names[t_d.creatures[i].number]); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + } + } + break; + + case 1: + sprintf(get_text,"\r\r Medium Town Creatures [40]: type number > 0\r"); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + for (i = 0; i < 40; i++) { + if (ave_t.creatures[i].number > 0) { + sprintf(get_text," Creature %d: x = %d, y = %d, type = %d, attitude = %d, hidden class = %d, name = %s\r",i,ave_t.creatures[i].start_loc.x,ave_t.creatures[i].start_loc.y,ave_t.creatures[i].number,ave_t.creatures[i].start_attitude,ave_t.creatures[i].spec_enc_code,scen_item_list.monst_names[ave_t.creatures[i].number]); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + } + } + break; + + case 2: + sprintf(get_text,"\r\r Small Town Creatures [30]: type number > 0\r"); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + for (i = 0; i < 30; i++) { + if (tiny_t.creatures[i].number > 0) { + sprintf(get_text," Creature %d: x = %d, y = %d, type = %d, attitude = %d, hidden class = %d, name = %s\r",i,tiny_t.creatures[i].start_loc.x,tiny_t.creatures[i].start_loc.y,tiny_t.creatures[i].number,tiny_t.creatures[i].start_attitude,tiny_t.creatures[i].spec_enc_code,scen_item_list.monst_names[tiny_t.creatures[i].number]); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + } + } + break; + } + sprintf(get_text,"\r\r Town Special Nodes: [100]\r"); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + for (i = 0; i < 100; i++) { + if (town.specials[i].type > 0) { + get_str(spec_name,22,town.specials[i].type + 1); + sprintf(get_text," Town special %d: Type = %d, SD1 = %d, SD2 = %d, Pic = %d, M1 = %d, M2 = %d, Ex1a = %d, Ex1b = %d, Ex2a = %d, Ex2b = %d, JumpTo = %d, Name = %s\r",i,town.specials[i].type,town.specials[i].sd1,town.specials[i].sd2,town.specials[i].pic,town.specials[i].m1,town.specials[i].m2,town.specials[i].ex1a,town.specials[i].ex1b,town.specials[i].ex2a,town.specials[i].ex2b,town.specials[i].jumpto,spec_name); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + } + } + sprintf(get_text,"\r\r"); + WriteFile(data_dump_file_id, get_text,strlen(get_text),&dwByteRead,NULL); + + CloseHandle(data_dump_file_id); +} + void start_data_dump() { short i,j,last_town = cur_town; diff --git a/Win32/Scenario Editor/TFILEIO.H b/Win32/Scenario Editor/TFILEIO.H index fb05de71..d013a051 100644 --- a/Win32/Scenario Editor/TFILEIO.H +++ b/Win32/Scenario Editor/TFILEIO.H @@ -11,6 +11,7 @@ void load_outdoors(location which_out,short mode); void load_town(short which_town); void import_town(short which_town); void oops_error(short error); +void start_town_data_dump(); void start_data_dump(); void start_shopping_data_dump(); void start_monst_data_dump();