diff --git a/src/fileio/fileio_scen.cpp b/src/fileio/fileio_scen.cpp index 2fcb2e2a..030c8e3e 100644 --- a/src/fileio/fileio_scen.cpp +++ b/src/fileio/fileio_scen.cpp @@ -1128,6 +1128,10 @@ void readEditorStateFromXml(ticpp::Document&& data, cScenario& scenario) { elem->GetText(&editor_state.overall_mode); }else if(type == "type-editing-mode"){ elem->GetText(&editor_state.type_editing_mode); + }else if(type == "string-editing-mode"){ + elem->GetText(&editor_state.string_editing_mode); + }else if(type == "special-editing-mode"){ + elem->GetText(&editor_state.special_editing_mode); } } } diff --git a/src/scenario/scenario.hpp b/src/scenario/scenario.hpp index 5d2457b7..5b008cc0 100644 --- a/src/scenario/scenario.hpp +++ b/src/scenario/scenario.hpp @@ -73,6 +73,8 @@ struct editor_state_t { // Non-drawing modes will be remembered and reopened when the editor launches. int overall_mode = -1; int type_editing_mode = -1; + int string_editing_mode = -1; + int special_editing_mode = -1; }; class cScenario { diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp index a83757e3..afdefbee 100644 --- a/src/scenedit/scen.actions.cpp +++ b/src/scenedit/scen.actions.cpp @@ -132,6 +132,8 @@ static cursor_type get_edit_cursor() { switch(overall_mode) { case MODE_INTRO_SCREEN: case MODE_MAIN_SCREEN: case MODE_EDIT_TYPES: case MODE_EDIT_SPECIALS: case MODE_EDIT_SPECIAL_ITEMS: + case MODE_EDIT_QUESTS: case MODE_EDIT_SHOPS: case MODE_EDIT_STRINGS: + case MODE_EDIT_DIALOGUE: case MODE_PLACE_CREATURE: case MODE_PLACE_ITEM: case MODE_PLACE_SPECIAL: @@ -279,23 +281,23 @@ static bool handle_lb_action(int i){ break; case LB_EDIT_TEXT: right_sbar->setPosition(0); - start_string_editing(STRS_SCEN,0); + start_string_editing(STRS_SCEN); break; case LB_EDIT_SPECITEM: start_special_item_editing(); break; case LB_EDIT_QUEST: - start_quest_editing(false); + start_quest_editing(); break; case LB_EDIT_SHOPS: - start_shops_editing(false); + start_shops_editing(); break; case LB_LOAD_OUT: spot_hit = pick_out(cur_out, scenario); if(spot_hit != cur_out) { set_current_out(spot_hit, false); if(overall_mode == MODE_EDIT_SPECIALS){ - start_special_editing(1, false); + start_special_editing(1); } } break; @@ -310,7 +312,7 @@ static bool handle_lb_action(int i){ town = scenario.towns[cur_town]; set_up_main_screen(); if(overall_mode == MODE_EDIT_SPECIALS){ - start_special_editing(2, false); + start_special_editing(2); } } break; @@ -319,7 +321,7 @@ static bool handle_lb_action(int i){ mouse_button_held = false; break; case LB_EDIT_TALK: - start_dialogue_editing(0); + start_dialogue_editing(); break; } } @@ -374,7 +376,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { scenario.scen_specials.emplace_back(); edit_spec_enc(j,0,nullptr); } - start_special_editing(0,size_before == scenario.scen_specials.size()); + start_special_editing(0); if(size_before > scenario.scen_specials.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -392,7 +394,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { current_terrain->specials.emplace_back(); edit_spec_enc(j,1,nullptr); } - start_special_editing(1,size_before == current_terrain->specials.size()); + start_special_editing(1); if(size_before > current_terrain->specials.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -410,7 +412,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { town->specials.emplace_back(); edit_spec_enc(j,2,nullptr); } - start_special_editing(2,size_before == town->specials.size()); + start_special_editing(2); if(size_before > town->specials.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -429,7 +431,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { if(!edit_text_str(j,STRS_SCEN) && j == size_before && scenario.spec_strs[j] == "*") scenario.spec_strs.pop_back(); } - start_string_editing(STRS_SCEN,size_before == scenario.spec_strs.size()); + start_string_editing(STRS_SCEN); if(size_before > scenario.spec_strs.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -448,7 +450,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { if(!edit_text_str(j,STRS_OUT) && j == size_before && current_terrain->spec_strs[j] == "*") current_terrain->spec_strs.pop_back(); } - start_string_editing(STRS_OUT,size_before == current_terrain->spec_strs.size()); + start_string_editing(STRS_OUT); if(size_before > current_terrain->spec_strs.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -467,7 +469,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { if(!edit_text_str(j,STRS_TOWN) && j == size_before && town->spec_strs[j] == "*") town->spec_strs.pop_back(); } - start_string_editing(STRS_TOWN,size_before == town->spec_strs.size()); + start_string_editing(STRS_TOWN); if(size_before > town->spec_strs.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -532,7 +534,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { if(!edit_text_str(j,STRS_JOURNAL) && j == size_before && scenario.journal_strs[j] == "*") scenario.journal_strs.pop_back(); } - start_string_editing(STRS_JOURNAL,size_before == scenario.journal_strs.size()); + start_string_editing(STRS_JOURNAL); if(size_before > scenario.journal_strs.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -549,14 +551,14 @@ static bool handle_rb_action(location the_point, bool option_hit) { if((j = edit_talk_node(j)) >= 0 && town->talking.talk_nodes[j].personality == -1) town->talking.talk_nodes.erase(town->talking.talk_nodes.begin() + j); } - start_dialogue_editing(size_before == town->talking.talk_nodes.size()); + start_dialogue_editing(); if(size_before > town->talking.talk_nodes.size()) pos_before--; right_sbar->setPosition(pos_before); break; case RB_PERSONALITY: edit_basic_dlog(j); - start_dialogue_editing(1); + start_dialogue_editing(); break; case RB_OUT_SIGN: size_before = current_terrain->sign_locs.size(); @@ -572,7 +574,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { if(!edit_text_str(j,STRS_OUT_SIGN) && j == size_before && current_terrain->sign_locs[j].text == "*") current_terrain->sign_locs.pop_back(); } - start_string_editing(STRS_OUT_SIGN,size_before == current_terrain->sign_locs.size()); + start_string_editing(STRS_OUT_SIGN); if(size_before > current_terrain->sign_locs.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -591,7 +593,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { if(!edit_text_str(j,STRS_TOWN_SIGN) && j == size_before && town->sign_locs[j].text == "*") town->sign_locs.pop_back(); } - start_string_editing(STRS_TOWN_SIGN,size_before == town->sign_locs.size()); + start_string_editing(STRS_TOWN_SIGN); if(size_before > town->sign_locs.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -610,7 +612,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { if(!edit_text_str(j,STRS_OUT_RECT) && j == size_before && current_terrain->area_desc[j].descr == "*") current_terrain->area_desc.pop_back(); } - start_string_editing(STRS_OUT_RECT,size_before == current_terrain->area_desc.size()); + start_string_editing(STRS_OUT_RECT); if(size_before > current_terrain->area_desc.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -629,7 +631,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { if(!edit_text_str(j,STRS_TOWN_RECT) && j == size_before && town->area_desc[j].descr == "*") town->area_desc.pop_back(); } - start_string_editing(STRS_TOWN_RECT,size_before == town->area_desc.size()); + start_string_editing(STRS_TOWN_RECT); if(size_before > town->area_desc.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -647,7 +649,6 @@ static bool handle_rb_action(location the_point, bool option_hit) { if(!edit_quest(j) && j == size_before && scenario.quests[j].name == "New Quest") scenario.quests.pop_back(); } - start_quest_editing(size_before == scenario.quests.size()); if(size_before > scenario.quests.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -662,7 +663,7 @@ static bool handle_rb_action(location the_point, bool option_hit) { if(!edit_shop(j) && j == size_before && scenario.shops[j].getName() == "New Shop") scenario.shops.pop_back(); } - start_shops_editing(size_before == scenario.shops.size()); + start_shops_editing(); if(size_before > scenario.shops.size()) pos_before--; right_sbar->setPosition(pos_before); @@ -1204,6 +1205,10 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) { case MODE_MAIN_SCREEN: case MODE_EDIT_SPECIALS: case MODE_EDIT_SPECIAL_ITEMS: + case MODE_EDIT_QUESTS: + case MODE_EDIT_SHOPS: + case MODE_EDIT_STRINGS: + case MODE_EDIT_DIALOGUE: break; // Nothing to do here, of course. case MODE_COPY_CREATURE: for(short x = 0; x < town->creatures.size(); x++) @@ -2977,48 +2982,29 @@ void start_special_item_editing() { redraw_screen(); } -void start_quest_editing(bool just_redo_text) { +void start_quest_editing() { int num_options = scenario.quests.size() + 1; - if(!just_redo_text) { - handle_close_terrain_view(MODE_MAIN_SCREEN); - right_sbar->show(); - pal_sbar->hide(); - right_sbar->setPosition(0); - reset_rb(); - right_sbar->setMaximum(num_options - NRSONPAGE); - } - for(int i = 0; i < num_options; i++) { - std::string title; - if(i == scenario.quests.size()) - title = "Create New Quest"; - else title = scenario.quests[i].name; - title = std::to_string(i) + " - " + title; - set_rb(i, RB_QUEST, i, title); - } - set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click to delete",true); + + handle_close_terrain_view(MODE_EDIT_QUESTS); + right_sbar->show(); + pal_sbar->hide(); + right_sbar->setPosition(0); + reset_rb(); + right_sbar->setMaximum(num_options - NRSONPAGE); + update_mouse_spot(translate_mouse_coordinates(sf::Mouse::getPosition(mainPtr()))); redraw_screen(); } -void start_shops_editing(bool just_redo_text) { +void start_shops_editing() { int num_options = scenario.shops.size() + 1; - if(!just_redo_text) { - handle_close_terrain_view(MODE_MAIN_SCREEN); - right_sbar->show(); - pal_sbar->hide(); - right_sbar->setPosition(0); - reset_rb(); - right_sbar->setMaximum(num_options - NRSONPAGE); - } - for(int i = 0; i < num_options; i++) { - std::string title; - if(i == scenario.shops.size()) - title = "Create New Shop"; - else title = scenario.shops[i].getName(); - title = std::to_string(i) + " - " + title; - set_rb(i, RB_SHOP, i, title); - } - set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click to delete",true); + handle_close_terrain_view(MODE_EDIT_SHOPS); + right_sbar->show(); + pal_sbar->hide(); + right_sbar->setPosition(0); + reset_rb(); + right_sbar->setMaximum(num_options - NRSONPAGE); + update_mouse_spot(translate_mouse_coordinates(sf::Mouse::getPosition(mainPtr()))); redraw_screen(); } @@ -3026,77 +3012,22 @@ void start_shops_editing(bool just_redo_text) { extern size_t num_strs(short mode); // defined in scen.keydlgs.cpp // mode 0 - scen 1 - out 2 - town 3 - journal -// if just_redo_text not 0, simply need to update text portions -void start_string_editing(eStrMode mode,short just_redo_text) { - if(just_redo_text == 0) { - handle_close_terrain_view(MODE_MAIN_SCREEN); - right_sbar->show(); - pal_sbar->hide(); - - reset_rb(); - right_sbar->setMaximum(num_strs(mode) + 1 - NRSONPAGE); - } - size_t num_strs = ::num_strs(mode); - for(size_t i = 0; i < num_strs; i++) { - std::ostringstream str; - switch(mode) { - case 0: - str << i << " - " << scenario.spec_strs[i]; - set_rb(i,RB_SCEN_STR, i,str.str()); - break; - case 1: - str << i << " - " << current_terrain->spec_strs[i]; - set_rb(i,RB_OUT_STR, i,str.str()); - break; - case 2: - str << i << " - " << town->spec_strs[i]; - set_rb(i,RB_TOWN_STR, i,str.str()); - break; - case 3: - str << i << " - " << scenario.journal_strs[i]; - set_rb(i,RB_JOURNAL, i,str.str()); - break; - case 4: - str << i << " - " << current_terrain->sign_locs[i]; - set_rb(i,RB_OUT_SIGN, i,str.str()); - break; - case 5: - str << i << " - " << town->sign_locs[i].text; - set_rb(i,RB_TOWN_SIGN, i,str.str()); - break; - case 6: - str << i << " - " << current_terrain->area_desc[i]; - set_rb(i,RB_OUT_RECT, i,str.str()); - break; - case 7: - str << i << " - " << town->area_desc[i].descr; - set_rb(i,RB_TOWN_RECT, i,str.str()); - break; - } - } - if(mode <= STRS_JOURNAL) { - // Signs and area rects don't get a Create New option – you create a new one on the map. - std::string make_new = std::to_string(num_strs) + " - Create New String"; - switch(mode) { - case 0: set_rb(num_strs, RB_SCEN_STR, num_strs, make_new); break; - case 1: set_rb(num_strs, RB_OUT_STR, num_strs, make_new); break; - case 2: set_rb(num_strs, RB_TOWN_STR, num_strs, make_new); break; - case 3: set_rb(num_strs, RB_JOURNAL, num_strs, make_new); break; - case 4: set_rb(num_strs, RB_OUT_SIGN, num_strs, make_new); break; - case 5: set_rb(num_strs, RB_TOWN_SIGN, num_strs, make_new); break; - case 6: set_rb(num_strs, RB_OUT_RECT, num_strs, make_new); break; - case 7: set_rb(num_strs, RB_TOWN_RECT, num_strs, make_new); break; - } - } +void start_string_editing(eStrMode mode) { + handle_close_terrain_view(MODE_EDIT_STRINGS); + scenario.editor_state.string_editing_mode = mode; + + right_sbar->show(); + pal_sbar->hide(); - set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click to delete",true); + reset_rb(); + right_sbar->setMaximum(num_strs(mode) + 1 - NRSONPAGE); + update_mouse_spot(translate_mouse_coordinates(sf::Mouse::getPosition(mainPtr()))); redraw_screen(); } // mode 0 - scen 1 - out 2 - town -// if just_redo_text not 0, simply need to update text portions -void start_special_editing(short mode,short just_redo_text) { +void start_special_editing(short mode) { size_t num_specs; switch(mode) { case 0: num_specs = scenario.scen_specials.size(); break; @@ -3104,74 +3035,26 @@ void start_special_editing(short mode,short just_redo_text) { case 2: num_specs = town->specials.size(); break; } - if(just_redo_text == 0) { - handle_close_terrain_view(MODE_MAIN_SCREEN); - right_sbar->show(); - pal_sbar->hide(); - - reset_rb(); - right_sbar->setMaximum(num_specs + 1 - NRSONPAGE); - } - overall_mode = MODE_EDIT_SPECIALS; + handle_close_terrain_view(MODE_EDIT_SPECIALS); + scenario.editor_state.special_editing_mode = mode; + right_sbar->show(); + pal_sbar->hide(); - for(size_t i = 0; i < num_specs; i++) { - std::ostringstream strb; - switch(mode) { - case 0: - strb << i << " - " << (*scenario.scen_specials[i].type).name(); - set_rb(i,RB_SCEN_SPEC, i, strb.str()); - break; - case 1: - strb << i << " - " << (*current_terrain->specials[i].type).name(); - set_rb(i,RB_OUT_SPEC, i, strb.str()); - break; - case 2: - strb << i << " - " << (*town->specials[i].type).name(); - set_rb(i,RB_TOWN_SPEC, i, strb.str()); - break; - } - } - std::string make_new = std::to_string(num_specs) + " - Create New Special"; - switch(mode) { - case 0: set_rb(num_specs, RB_SCEN_SPEC, num_specs, make_new); break; - case 1: set_rb(num_specs, RB_OUT_SPEC, num_specs, make_new); break; - case 2: set_rb(num_specs, RB_TOWN_SPEC, num_specs, make_new); break; - } - set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click to delete",true); + reset_rb(); + right_sbar->setMaximum(num_specs + 1 - NRSONPAGE); + update_mouse_spot(translate_mouse_coordinates(sf::Mouse::getPosition(mainPtr()))); redraw_screen(); } -// if restoring is 1, this is just a redraw, so don't move scroll bar position -void start_dialogue_editing(short restoring) { - char s[15] = " , "; - - handle_close_terrain_view(MODE_MAIN_SCREEN); +void start_dialogue_editing() { + handle_close_terrain_view(MODE_EDIT_DIALOGUE); right_sbar->show(); pal_sbar->hide(); - if(restoring == 0) { - right_sbar->setPosition(0); - reset_rb(); - } - for(short i = 0; i < 10; i++) { - std::ostringstream strb; - strb << "Personality " << (i + cur_town * 10) << " - " << town->talking.people[i].title; - set_rb(i,RB_PERSONALITY, i, strb.str()); - } - size_t n_nodes = town->talking.talk_nodes.size(); - for(short i = 0; i < n_nodes; i++) { - for(short j = 0; j < 4; j++) { - s[j] = town->talking.talk_nodes[i].link1[j]; - s[j + 6] = town->talking.talk_nodes[i].link2[j]; - } - std::ostringstream strb; - strb << "Node " << i << " - Per. " << town->talking.talk_nodes[i].personality << ", " << s; - set_rb(10 + i,RB_DIALOGUE, i, strb.str()); - } - set_rb(10 + n_nodes, RB_DIALOGUE, n_nodes, "Create New Node"); - right_sbar->setMaximum((11 + n_nodes) - NRSONPAGE); - set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click node to delete",true); + right_sbar->setPosition(0); + reset_rb(); + update_mouse_spot(translate_mouse_coordinates(sf::Mouse::getPosition(mainPtr()))); redraw_screen(); } diff --git a/src/scenedit/scen.actions.hpp b/src/scenedit/scen.actions.hpp index af22cbca..d7ee21db 100644 --- a/src/scenedit/scen.actions.hpp +++ b/src/scenedit/scen.actions.hpp @@ -38,12 +38,12 @@ void start_town_edit(); void start_out_edit(); void start_type_editing(eDrawMode mode); void start_special_item_editing(); -void start_quest_editing(bool just_redo_text); -void start_shops_editing(bool just_redo_text); -void start_string_editing(eStrMode mode,short just_redo_text); -void start_special_editing(short mode,short just_redo_text); +void start_quest_editing(); +void start_shops_editing(); +void start_string_editing(eStrMode mode); +void start_special_editing(short mode); void town_entry(location spot_hit); -void start_dialogue_editing(short restoring); +void start_dialogue_editing(); void update_mouse_spot(location the_point); bool monst_on_space(location loc,short m_num); diff --git a/src/scenedit/scen.fileio.cpp b/src/scenedit/scen.fileio.cpp index e20ac8da..e0987971 100644 --- a/src/scenedit/scen.fileio.cpp +++ b/src/scenedit/scen.fileio.cpp @@ -153,6 +153,8 @@ void writeEditorStateToXml(ticpp::Printer&& data, cScenario& scenario) { data.PushElement("overall-mode", scenario.editor_state.overall_mode); data.PushElement("type-editing-mode", scenario.editor_state.type_editing_mode); + data.PushElement("string-editing-mode", scenario.editor_state.string_editing_mode); + data.PushElement("special-editing-mode", scenario.editor_state.special_editing_mode); data.CloseElement("editor"); } diff --git a/src/scenedit/scen.global.hpp b/src/scenedit/scen.global.hpp index 797f877c..435fdbd6 100644 --- a/src/scenedit/scen.global.hpp +++ b/src/scenedit/scen.global.hpp @@ -83,7 +83,10 @@ enum eScenMode { MODE_EDIT_TYPES = 62, // currently only used for editing terrain, but I'd like to use it for editing monsters and items too. MODE_EDIT_SPECIALS = 63, // editing a LIST of specials, not to be confused with MODE_EDIT_SPECIAL singular MODE_EDIT_SPECIAL_ITEMS = 64, - + MODE_EDIT_QUESTS = 65, + MODE_EDIT_SHOPS = 66, + MODE_EDIT_STRINGS = 67, + MODE_EDIT_DIALOGUE = 68, }; enum eDrawMode { diff --git a/src/scenedit/scen.graphics.cpp b/src/scenedit/scen.graphics.cpp index 2e84c889..2f21f0ae 100644 --- a/src/scenedit/scen.graphics.cpp +++ b/src/scenedit/scen.graphics.cpp @@ -422,6 +422,8 @@ void redraw_screen() { mainPtr().display(); } +extern size_t num_strs(short mode); // defined in scen.keydlgs.cpp + void apply_mode_buttons() { right_button_status.clear(); int num_options; @@ -438,6 +440,144 @@ void apply_mode_buttons() { } set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click to delete",true); break; + case MODE_EDIT_QUESTS: + num_options = scenario.quests.size() + 1; + for(int i = 0; i < num_options; i++) { + std::string title; + if(i == scenario.quests.size()) + title = "Create New Quest"; + else title = scenario.quests[i].name; + title = std::to_string(i) + " - " + title; + set_rb(i, RB_QUEST, i, title); + } + set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click to delete",true); + break; + case MODE_EDIT_SHOPS: + num_options = scenario.shops.size() + 1; + for(int i = 0; i < num_options; i++) { + std::string title; + if(i == scenario.shops.size()) + title = "Create New Shop"; + else title = scenario.shops[i].getName(); + title = std::to_string(i) + " - " + title; + set_rb(i, RB_SHOP, i, title); + } + set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click to delete",true); + break; + case MODE_EDIT_STRINGS:{ + eStrMode mode = static_cast(scenario.editor_state.string_editing_mode); + size_t num_strs = ::num_strs(mode); + + for(size_t i = 0; i < num_strs; i++) { + std::ostringstream str; + switch(mode) { + case 0: + str << i << " - " << scenario.spec_strs[i]; + set_rb(i,RB_SCEN_STR, i,str.str()); + break; + case 1: + str << i << " - " << current_terrain->spec_strs[i]; + set_rb(i,RB_OUT_STR, i,str.str()); + break; + case 2: + str << i << " - " << town->spec_strs[i]; + set_rb(i,RB_TOWN_STR, i,str.str()); + break; + case 3: + str << i << " - " << scenario.journal_strs[i]; + set_rb(i,RB_JOURNAL, i,str.str()); + break; + case 4: + str << i << " - " << current_terrain->sign_locs[i]; + set_rb(i,RB_OUT_SIGN, i,str.str()); + break; + case 5: + str << i << " - " << town->sign_locs[i].text; + set_rb(i,RB_TOWN_SIGN, i,str.str()); + break; + case 6: + str << i << " - " << current_terrain->area_desc[i]; + set_rb(i,RB_OUT_RECT, i,str.str()); + break; + case 7: + str << i << " - " << town->area_desc[i].descr; + set_rb(i,RB_TOWN_RECT, i,str.str()); + break; + } + } + if(mode <= STRS_JOURNAL) { + // Signs and area rects don't get a Create New option – you create a new one on the map. + std::string make_new = std::to_string(num_strs) + " - Create New String"; + switch(mode) { + case 0: set_rb(num_strs, RB_SCEN_STR, num_strs, make_new); break; + case 1: set_rb(num_strs, RB_OUT_STR, num_strs, make_new); break; + case 2: set_rb(num_strs, RB_TOWN_STR, num_strs, make_new); break; + case 3: set_rb(num_strs, RB_JOURNAL, num_strs, make_new); break; + case 4: set_rb(num_strs, RB_OUT_SIGN, num_strs, make_new); break; + case 5: set_rb(num_strs, RB_TOWN_SIGN, num_strs, make_new); break; + case 6: set_rb(num_strs, RB_OUT_RECT, num_strs, make_new); break; + case 7: set_rb(num_strs, RB_TOWN_RECT, num_strs, make_new); break; + } + } + + set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click to delete",true); + }break; + case MODE_EDIT_SPECIALS:{ + size_t num_specs; + short mode = scenario.editor_state.special_editing_mode; + switch(mode) { + case 0: num_specs = scenario.scen_specials.size(); break; + case 1: num_specs = current_terrain->specials.size(); break; + case 2: num_specs = town->specials.size(); break; + } + + for(size_t i = 0; i < num_specs; i++) { + std::ostringstream strb; + switch(mode) { + case 0: + strb << i << " - " << (*scenario.scen_specials[i].type).name(); + set_rb(i,RB_SCEN_SPEC, i, strb.str()); + break; + case 1: + strb << i << " - " << (*current_terrain->specials[i].type).name(); + set_rb(i,RB_OUT_SPEC, i, strb.str()); + break; + case 2: + strb << i << " - " << (*town->specials[i].type).name(); + set_rb(i,RB_TOWN_SPEC, i, strb.str()); + break; + } + } + std::string make_new = std::to_string(num_specs) + " - Create New Special"; + switch(mode) { + case 0: set_rb(num_specs, RB_SCEN_SPEC, num_specs, make_new); break; + case 1: set_rb(num_specs, RB_OUT_SPEC, num_specs, make_new); break; + case 2: set_rb(num_specs, RB_TOWN_SPEC, num_specs, make_new); break; + } + set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click to delete",true); + }break; + case MODE_EDIT_DIALOGUE:{ + // TODO use stringstream and give more readable info + char s[15] = " , "; + for(short i = 0; i < 10; i++) { + std::ostringstream strb; + strb << "Personality " << (i + cur_town * 10) << " - " << town->talking.people[i].title; + set_rb(i,RB_PERSONALITY, i, strb.str()); + } + size_t n_nodes = town->talking.talk_nodes.size(); + for(short i = 0; i < n_nodes; i++) { + for(short j = 0; j < 4; j++) { + s[j] = town->talking.talk_nodes[i].link1[j]; + s[j + 6] = town->talking.talk_nodes[i].link2[j]; + } + std::ostringstream strb; + strb << "Node " << i << " - Per. " << town->talking.talk_nodes[i].personality << ", " << s; + set_rb(10 + i,RB_DIALOGUE, i, strb.str()); + } + set_rb(10 + n_nodes, RB_DIALOGUE, n_nodes, "Create New Node"); + right_sbar->setMaximum((11 + n_nodes) - NRSONPAGE); + set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"Alt-click node to delete",true); + }break; default: break; } } diff --git a/src/scenedit/scen.main.cpp b/src/scenedit/scen.main.cpp index c7aa4f15..5284ad38 100644 --- a/src/scenedit/scen.main.cpp +++ b/src/scenedit/scen.main.cpp @@ -602,15 +602,15 @@ void handle_menu_choice(eMenu item_hit) { break; case eMenu::SCEN_SPECIALS: right_sbar->setPosition(0); - start_special_editing(0,0); + start_special_editing(0); break; case eMenu::SCEN_TEXT: right_sbar->setPosition(0); - start_string_editing(STRS_SCEN,0); + start_string_editing(STRS_SCEN); break; case eMenu::SCEN_JOURNALS: right_sbar->setPosition(0); - start_string_editing(STRS_JOURNAL,0); + start_string_editing(STRS_JOURNAL); break; case eMenu::TOWN_IMPORT: if(cTown* town = pick_import_town()) { @@ -685,7 +685,7 @@ void handle_menu_choice(eMenu item_hit) { break; case eMenu::TOWN_AREAS: right_sbar->setPosition(0); - start_string_editing(STRS_TOWN_RECT,0); + start_string_editing(STRS_TOWN_RECT); break; case eMenu::TOWN_ITEMS_RANDOM: if(cChoiceDlog("add-random-items", {"okay", "cancel"}).show() == "cancel") @@ -737,15 +737,15 @@ void handle_menu_choice(eMenu item_hit) { }break; case eMenu::TOWN_SPECIALS: right_sbar->setPosition(0); - start_special_editing(2,0); + start_special_editing(2); break; case eMenu::TOWN_TEXT: right_sbar->setPosition(0); - start_string_editing(STRS_TOWN,0); + start_string_editing(STRS_TOWN); break; case eMenu::TOWN_SIGNS: right_sbar->setPosition(0); - start_string_editing(STRS_TOWN_SIGN,0); + start_string_editing(STRS_TOWN_SIGN); break; case eMenu::TOWN_ADVANCED: edit_advanced_town(); @@ -769,19 +769,19 @@ void handle_menu_choice(eMenu item_hit) { break; case eMenu::OUT_AREAS: right_sbar->setPosition(0); - start_string_editing(STRS_OUT_RECT,0); + start_string_editing(STRS_OUT_RECT); break; case eMenu::OUT_SPECIALS: right_sbar->setPosition(0); - start_special_editing(1,0); + start_special_editing(1); break; case eMenu::OUT_TEXT: right_sbar->setPosition(0); - start_string_editing(STRS_OUT,0); + start_string_editing(STRS_OUT); break; case eMenu::OUT_SIGNS: right_sbar->setPosition(0); - start_string_editing(STRS_OUT_SIGN,0); + start_string_editing(STRS_OUT_SIGN); break; case eMenu::ABOUT: helpDlog = "about-scened";