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:
2025-02-18 11:33:36 -06:00
committed by Celtic Minstrel
parent 0f4b1124f6
commit 0afed5db59
22 changed files with 195 additions and 83 deletions

View File

@@ -1580,8 +1580,8 @@ class cChooseScenario {
sout << '.' << int(scen_headers[page * 3 + i].ver[2]);
sout << " - | Difficulty: " << difficulty[scen_headers[page * 3 + i].difficulty];
sout << ", Rating: " << scen_headers[page * 3 + i].rating;
sout << " |" << scen_headers[page * 3 + i].who1;
sout << " |" << scen_headers[page * 3 + i].who2;
sout << " |" << scen_headers[page * 3 + i].teaser1;
sout << " |" << scen_headers[page * 3 + i].teaser2;
me["desc" + n].setText(sout.str());
me["start" + n].show();
} else {

View File

@@ -357,11 +357,12 @@ std::vector<scen_header_type> build_scen_headers() {
scen_headers.push_back(scen_head);
}else{
scen_header_type missing_scen;
missing_scen.intro_pic = missing_scen.rating = missing_scen.difficulty = 0;
missing_scen.intro_pic = missing_scen.difficulty = 0;
missing_scen.rating = eContentRating::G;
for(int i=0; i<3; ++i)
missing_scen.ver[i] = missing_scen.prog_make_ver[i] = 0;
missing_scen.name = scen_file;
missing_scen.who1 = missing_scen.who2 = missing_scen.file = "";
missing_scen.teaser1 = missing_scen.teaser2 = missing_scen.file = "";
scen_headers.push_back(missing_scen);
}
}
@@ -446,8 +447,26 @@ bool load_scenario_header(fs::path file,scen_header_type& scen_head){
return false;
scen_head.name = temp_scenario.scen_name;
scen_head.who1 = temp_scenario.who_wrote[0];
scen_head.who2 = temp_scenario.who_wrote[1];
// Legacy scenario meta display: Teaser 1/2 are mixed with credits, other fields hidden.
if(!temp_scenario.has_feature_flag("scenario-meta-format")){
scen_head.teaser1 = temp_scenario.teaser_text[0];
scen_head.teaser2 = temp_scenario.teaser_text[1];
}
// V2 meta display: By {Author}, Contact: {Contact}|{Teaser!}
else{
if(!temp_scenario.contact_info[0].empty()){
scen_head.teaser1 = "By " + temp_scenario.contact_info[0];
}
if(!temp_scenario.contact_info[1].empty()){
if(!scen_head.teaser1.empty()) scen_head.teaser1 += ", ";
scen_head.teaser1 += "Contact: " + temp_scenario.contact_info[1];
}
if(scen_head.teaser1.empty())
scen_head.teaser1 = temp_scenario.teaser_text[0];
else
scen_head.teaser2 = temp_scenario.teaser_text[0];
}
scen_head.file = fname == "header.exs" ? file.parent_path().filename().string() : fname;
scen_head.intro_pic = temp_scenario.intro_pic;
scen_head.rating = temp_scenario.rating;

View File

@@ -20,8 +20,10 @@ const int NUM_FACE_G = 80;
const int NUM_DLOG_G = 28;
struct scen_header_type{
int intro_pic, rating, difficulty, ver[3], prog_make_ver[3];
std::string name, who1, who2, file;
int intro_pic;
eContentRating rating;
int difficulty, ver[3], prog_make_ver[3];
std::string name, teaser1, teaser2, file;
};
struct effect_pat_type {