A feature flag denotes whether a scenario uses the new or old format for its metadata. With the old format (legacy scenarios and openBoE scenarios created prior to this PR) everything displays in the scenario picker as before, and scenario designers get 2 text fields to display however they want, and 2 text fields that are pretty much useless.
With the new format, Author and Contact info are formatted onto the first line in the scenario picker display. The scenario designer gets 1 line to write a teaser. Fix #593 Also fix a bug where scenario ratings were appearing as integers ingame instead of the correct "G", "PG", etc.
This commit is contained in:
@@ -2796,12 +2796,45 @@ static bool save_scen_details(cDialog& me, std::string, eKeyMod) {
|
||||
case '4': scenario.rating = eContentRating::NC17; break;
|
||||
}
|
||||
}
|
||||
scenario.adjust_diff = dynamic_cast<cLed&>(me["adjust"]).getState() != led_red;
|
||||
scenario.scen_name = me["title"].getText();
|
||||
for(short i = 0; i < 3; i++)
|
||||
scenario.format.ver[i] = me["ver" + std::to_string(i + 1)].getTextAsNum();
|
||||
scenario.who_wrote[0] = me["who1"].getText().substr(0, 100);
|
||||
scenario.who_wrote[1] = me["who2"].getText().substr(0, 100);
|
||||
scenario.contact_info[1] = me["contact"].getText().substr(0, 256);
|
||||
scenario.teaser_text[0] = me["teaser1"].getText();
|
||||
scenario.teaser_text[1] = me["teaser2"].getText();
|
||||
scenario.contact_info[0] = me["author"].getText();
|
||||
scenario.contact_info[1] = me["contact"].getText();
|
||||
return true;
|
||||
}
|
||||
|
||||
static void put_scen_details_in_dlog(cDialog& me) {
|
||||
me["title"].setText(scenario.scen_name);
|
||||
dynamic_cast<cLedGroup&>(me["difficulty"]).setSelected("lvl" + std::to_string(scenario.difficulty + 1));
|
||||
dynamic_cast<cLedGroup&>(me["rating"]).setSelected("rate" + std::to_string(scenario.rating + 1));
|
||||
for(int i = 0; i < 3; i++)
|
||||
me["ver" + std::to_string(i + 1)].setTextToNum(scenario.format.ver[i]);
|
||||
// Legacy meta text labels:
|
||||
if(!scenario.has_feature_flag("scenario-meta-format")){
|
||||
me["teaser1-text"].setText("Credits/Teaser Part 1:");
|
||||
me["teaser2-text"].setText("Credits/Teaser Part 2:");
|
||||
me["author-text"].setText("Author|(not displayed):");
|
||||
me["contact-text"].setText("Contact info|(not displayed):");
|
||||
}else{
|
||||
// Updated meta text labels:
|
||||
me["teaser2-text"].hide();
|
||||
me["teaser2"].hide();
|
||||
}
|
||||
|
||||
me["teaser1"].setText(scenario.teaser_text[0]);
|
||||
me["teaser2"].setText(scenario.teaser_text[1]);
|
||||
me["author"].setText(scenario.contact_info[0]);
|
||||
me["contact"].setText(scenario.contact_info[1]);
|
||||
}
|
||||
|
||||
static bool save_scen_adv_details(cDialog& me, std::string, eKeyMod) {
|
||||
if(!me.toast(true)) return true;
|
||||
|
||||
scenario.adjust_diff = dynamic_cast<cLed&>(me["adjust"]).getState() != led_red;
|
||||
|
||||
scenario.campaign_id = me["cpnid"].getText();
|
||||
scenario.bg_out = boost::lexical_cast<int>(me["bg-out"].getText().substr(10));
|
||||
scenario.bg_town = boost::lexical_cast<int>(me["bg-town"].getText().substr(10));
|
||||
@@ -2811,15 +2844,9 @@ static bool save_scen_details(cDialog& me, std::string, eKeyMod) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void put_scen_details_in_dlog(cDialog& me) {
|
||||
dynamic_cast<cLedGroup&>(me["difficulty"]).setSelected("lvl" + std::to_string(scenario.difficulty + 1));
|
||||
dynamic_cast<cLedGroup&>(me["rating"]).setSelected("rate" + std::to_string(scenario.rating + 1));
|
||||
|
||||
static void put_scen_adv_details_in_dlog(cDialog& me) {
|
||||
dynamic_cast<cLed&>(me["adjust"]).setState(scenario.adjust_diff ? led_red : led_off);
|
||||
for(int i = 0; i < 3; i++)
|
||||
me["ver" + std::to_string(i + 1)].setTextToNum(scenario.format.ver[i]);
|
||||
me["who1"].setText(scenario.who_wrote[0]);
|
||||
me["who2"].setText(scenario.who_wrote[1]);
|
||||
me["contact"].setText(scenario.contact_info[1]);
|
||||
me["cpnid"].setText(scenario.campaign_id);
|
||||
me["bg-out"].setText("Outdoors: " + std::to_string(scenario.bg_out));
|
||||
me["bg-town"].setText("In towns: " + std::to_string(scenario.bg_town));
|
||||
@@ -2863,14 +2890,22 @@ static bool edit_scen_default_bgs(cDialog& me, std::string which, eKeyMod) {
|
||||
void edit_scen_details() {
|
||||
cDialog info_dlg(*ResMgr::dialogs.get("edit-scenario-details"));
|
||||
info_dlg["okay"].attachClickHandler(save_scen_details);
|
||||
info_dlg.attachClickHandlers(edit_scen_default_bgs, {"bg-out", "bg-town", "bg-dungeon", "bg-fight"});
|
||||
info_dlg["pickinit"].attachClickHandler(edit_scen_init_spec);
|
||||
|
||||
put_scen_details_in_dlog(info_dlg);
|
||||
|
||||
info_dlg.run();
|
||||
}
|
||||
|
||||
void edit_scen_adv_details() {
|
||||
cDialog info_dlg(*ResMgr::dialogs.get("edit-scenario-advanced"));
|
||||
info_dlg["okay"].attachClickHandler(save_scen_adv_details);
|
||||
info_dlg.attachClickHandlers(edit_scen_default_bgs, {"bg-out", "bg-town", "bg-dungeon", "bg-fight"});
|
||||
info_dlg["pickinit"].attachClickHandler(edit_scen_init_spec);
|
||||
|
||||
put_scen_adv_details_in_dlog(info_dlg);
|
||||
info_dlg.run();
|
||||
}
|
||||
|
||||
bool edit_make_scen_1(std::string& author,std::string& title,bool& grass) {
|
||||
cDialog new_dlog(*ResMgr::dialogs.get("make-scenario1"));
|
||||
new_dlog["okay"].attachClickHandler(std::bind(&cDialog::toast, &new_dlog, true));
|
||||
@@ -2960,7 +2995,9 @@ bool build_scenario() {
|
||||
scenario.contact_info[0] = author;
|
||||
scenario.default_ground = grass ? 2 : 0;
|
||||
|
||||
scenario.feature_flags = {};
|
||||
scenario.feature_flags = {
|
||||
{"scenario-meta-format", "V2"}
|
||||
};
|
||||
|
||||
fs::path basePath = progDir/"Blades of Exile Base"/"bladbase.boes";
|
||||
if(!fs::exists(basePath)) {
|
||||
|
@@ -16,6 +16,7 @@ void edit_save_rects();
|
||||
void edit_add_town();
|
||||
void edit_item_placement();
|
||||
void edit_scen_details();
|
||||
void edit_scen_adv_details();
|
||||
bool edit_make_scen_2(short& out_w, short& out_h, short& town_l, short& town_m, short& town_s, bool& def_town);
|
||||
bool edit_make_scen_1(std::string& filename,std::string& title,bool& grass);
|
||||
void edit_scenario_events();
|
||||
|
@@ -139,8 +139,8 @@ void writeScenarioToXml(ticpp::Printer&& data, cScenario& scenario) {
|
||||
}
|
||||
data.CloseElement("feature-flags");
|
||||
data.OpenElement("text");
|
||||
data.PushElement("teaser", scenario.who_wrote[0]);
|
||||
data.PushElement("teaser", scenario.who_wrote[1]);
|
||||
data.PushElement("teaser", scenario.teaser_text[0]);
|
||||
data.PushElement("teaser", scenario.teaser_text[1]);
|
||||
if(scenario.intro_pic != scenario.intro_mess_pic)
|
||||
data.PushElement("icon", scenario.intro_mess_pic);
|
||||
{
|
||||
@@ -1209,8 +1209,8 @@ void scen_text_dump(){
|
||||
std::ofstream fout((scenario.scen_file.parent_path()/(scenario.scen_name + " Text.txt")).string().c_str());
|
||||
fout << "Scenario text for " << scenario.scen_name << ':' << endl << endl;
|
||||
fout << "Scenario Text:" << endl;
|
||||
fout << "Who Wrote 1: " << scenario.who_wrote[0] << endl;
|
||||
fout << "Who Wrote 2: " << scenario.who_wrote[1] << endl;
|
||||
fout << "Teaser 1: " << scenario.teaser_text[0] << endl;
|
||||
fout << "Teaser 2: " << scenario.teaser_text[1] << endl;
|
||||
fout << "Contact Info: " << scenario.contact_info[0] << " " << scenario.contact_info[1] << endl;
|
||||
for(short i = 0; i < scenario.intro_strs.size(); i++)
|
||||
if(scenario.intro_strs[i][0] != '*')
|
||||
|
@@ -553,6 +553,10 @@ void handle_menu_choice(eMenu item_hit) {
|
||||
edit_scen_details();
|
||||
change_made = true;
|
||||
break;
|
||||
case eMenu::SCEN_ADV_DETAILS:
|
||||
edit_scen_adv_details();
|
||||
change_made = true;
|
||||
break;
|
||||
case eMenu::SCEN_INTRO:
|
||||
edit_scen_intro();
|
||||
change_made = true;
|
||||
|
@@ -59,6 +59,7 @@ void OpenBoESceneditMenu::add_persistent_menu_items(tgui::MenuBar::Ptr& menubar)
|
||||
{ { "Scenario", "Advanced", "Edit Special Nodes" }, eMenu::SCEN_SPECIALS },
|
||||
{ { "Scenario", "Advanced", "Edit Scenario Text" }, eMenu::SCEN_TEXT },
|
||||
{ { "Scenario", "Advanced", "Edit Journal Entries" }, eMenu::SCEN_JOURNALS },
|
||||
{ { "Scenario", "Advanced", "Advanced Scenario Details" }, eMenu::SCEN_ADV_DETAILS },
|
||||
{ { "Scenario", "Advanced", "Import Town" }, eMenu::TOWN_IMPORT },
|
||||
{ { "Scenario", "Advanced", "Import Outdoor Sector" }, eMenu::OUT_IMPORT },
|
||||
{ { "Scenario", "Advanced", "Edit Saved Item Rectangles" }, eMenu::SCEN_SAVE_ITEM_RECTS },
|
||||
|
@@ -19,7 +19,8 @@ enum class eMenu {
|
||||
EDIT_UNDO, EDIT_REDO, EDIT_CUT, EDIT_COPY, EDIT_PASTE, EDIT_DELETE, EDIT_SELECT_ALL,
|
||||
HELP_TOC, HELP_START, HELP_TEST, HELP_DIST, HELP_CONTEST,
|
||||
// Scenario menu
|
||||
LAUNCH_HERE, LAUNCH_START, LAUNCH_ENTRANCE, TOWN_CREATE, OUT_RESIZE, SCEN_DETAILS, SCEN_INTRO, TOWN_START,
|
||||
LAUNCH_HERE, LAUNCH_START, LAUNCH_ENTRANCE, TOWN_CREATE, OUT_RESIZE,
|
||||
SCEN_DETAILS, SCEN_ADV_DETAILS, SCEN_INTRO, TOWN_START,
|
||||
SCEN_SPECIALS, SCEN_TEXT, SCEN_JOURNALS, TOWN_IMPORT, OUT_IMPORT,
|
||||
SCEN_SAVE_ITEM_RECTS,
|
||||
TOWN_VARYING, SCEN_TIMERS, SCEN_ITEM_SHORTCUTS, TOWN_DELETE,
|
||||
|
@@ -59,7 +59,7 @@ void init_menubar() {
|
||||
eMenu::LAUNCH_HERE, eMenu::LAUNCH_START, eMenu::LAUNCH_ENTRANCE, eMenu::NONE,
|
||||
eMenu::TOWN_CREATE, eMenu::OUT_RESIZE, eMenu::NONE,
|
||||
eMenu::SCEN_DETAILS, eMenu::SCEN_INTRO, eMenu::SCEN_SHEETS, eMenu::SCEN_PICS, eMenu::SCEN_SNDS, eMenu::NONE, eMenu::NONE,
|
||||
eMenu::SCEN_SPECIALS, eMenu::SCEN_TEXT, eMenu::SCEN_JOURNALS, eMenu::TOWN_IMPORT, eMenu::OUT_IMPORT, eMenu::SCEN_SAVE_ITEM_RECTS,
|
||||
eMenu::SCEN_SPECIALS, eMenu::SCEN_TEXT, eMenu::SCEN_JOURNALS, eMenu::SCEN_ADV_DETAILS, eMenu::TOWN_IMPORT, eMenu::OUT_IMPORT, eMenu::SCEN_SAVE_ITEM_RECTS,
|
||||
eMenu::TOWN_VARYING, eMenu::SCEN_TIMERS, eMenu::SCEN_ITEM_SHORTCUTS,
|
||||
eMenu::TOWN_DELETE, eMenu::SCEN_DATA_DUMP, eMenu::SCEN_TEXT_DUMP,
|
||||
};
|
||||
|
@@ -79,7 +79,8 @@ void init_menubar() {
|
||||
eMenu::LAUNCH_HERE, eMenu::LAUNCH_START, eMenu::LAUNCH_ENTRANCE, eMenu::NONE,
|
||||
eMenu::TOWN_CREATE, eMenu::OUT_RESIZE, eMenu::NONE,
|
||||
eMenu::SCEN_DETAILS, eMenu::SCEN_INTRO, eMenu::SCEN_SHEETS, eMenu::SCEN_PICS, eMenu::SCEN_SNDS, eMenu::NONE, eMenu::NONE,
|
||||
eMenu::SCEN_SPECIALS, eMenu::SCEN_TEXT, eMenu::SCEN_JOURNALS, eMenu::TOWN_IMPORT, eMenu::OUT_IMPORT, eMenu::SCEN_SAVE_ITEM_RECTS,
|
||||
eMenu::SCEN_SPECIALS, eMenu::SCEN_TEXT, eMenu::SCEN_JOURNALS, eMenu::SCEN_ADV_DETAILS,
|
||||
eMenu::TOWN_IMPORT, eMenu::OUT_IMPORT, eMenu::SCEN_SAVE_ITEM_RECTS,
|
||||
eMenu::TOWN_VARYING, eMenu::SCEN_TIMERS, eMenu::SCEN_ITEM_SHORTCUTS,
|
||||
eMenu::TOWN_DELETE, eMenu::SCEN_DATA_DUMP, eMenu::SCEN_TEXT_DUMP,
|
||||
};
|
||||
|
Reference in New Issue
Block a user