Fix scenario editor build and update data/docs regarding shop nodes
This commit is contained in:
@@ -2518,6 +2518,7 @@ bool build_scenario() {
|
||||
// TODO: This will probably change drastically once the new scenario format is implemented
|
||||
|
||||
make_new_scenario(filename,width,height,default_town,grass);
|
||||
scenario.shops.push_back(cShop('heal'));
|
||||
|
||||
overall_mode = MODE_MAIN_SCREEN;
|
||||
|
||||
|
@@ -292,11 +292,12 @@ short choose_text(eStrType list, unsigned short cur_choice, cDialog* parent, con
|
||||
}
|
||||
break;
|
||||
case STRT_CONTEXT:
|
||||
// TODO: This is a discontinous list, so there's probably a better way to deal with it...
|
||||
strings = *ResMgr::get<StringRsrc>("special-contexts");
|
||||
break;
|
||||
case STRT_SHOP:
|
||||
strings = {"Items", "Mage Spells", "Priest Spells", "Alchemy", "Healing", "Magic Shop: Junk", "Magic Shop: Lousy", "Magic Shop: So-so", "Magic Shop: Good", "Magic Shop: Great", "Skill Shop"};
|
||||
for(cShop& shop : scenario.shops) {
|
||||
strings.push_back(shop.getName());
|
||||
}
|
||||
break;
|
||||
case STRT_COST_ADJ:
|
||||
strings = {"Extremely Cheap", "Very Reasonable", "Pretty Average", "Somewhat Pricey", "Expensive", "Exorbitant", "Utterly Ridiculous"};
|
||||
@@ -711,18 +712,6 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
|
||||
if(type == eSpecType::CALL_GLOBAL) btn = 'S';
|
||||
else btn = 's';
|
||||
}
|
||||
if(btn == '#') {
|
||||
switch(eShopType(me["x1b"].getTextAsNum())) {
|
||||
case eShopType::ITEMS: btn = 'i'; break;
|
||||
case eShopType::MAGE: btn = 'A'; break;
|
||||
case eShopType::PRIEST: btn = 'P'; break;
|
||||
case eShopType::ALCHEMY: btn = 'a'; break;
|
||||
case eShopType::SKILLS: btn = 'k'; break;
|
||||
case eShopType::HEALING: case eShopType::MAGIC_GOOD: case eShopType::MAGIC_GREAT:
|
||||
case eShopType::MAGIC_JUNK: case eShopType::MAGIC_LOUSY: case eShopType::MAGIC_SO_SO:
|
||||
break;
|
||||
}
|
||||
}
|
||||
short val = me[field].getTextAsNum(), mode = (btn == 'S' || btn == '$') ? 0 : edit_stack.top().mode, store;
|
||||
short pictype = me["pictype"].getTextAsNum();
|
||||
bool choose_string = true;
|
||||
@@ -797,7 +786,7 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
|
||||
case '@': strt = STRT_ATTITUDE; title = "What attitude?"; break;
|
||||
case '/': strt = STRT_STAIR; title = "Which stairway text?"; break;
|
||||
case 'L': strt = STRT_LIGHT; title = "What lighting type?"; break;
|
||||
case '&': strt = STRT_SHOP; title = "What shop type?"; break;
|
||||
case '&': strt = STRT_SHOP; title = "Which shop?"; break;
|
||||
case '%': strt = STRT_COST_ADJ; title = "What cost adjust?"; break;
|
||||
case '*': strt = STRT_CONTEXT; title = "What context?"; break;
|
||||
case ':': strt = STRT_STAIR_MODE; title = "Select trigger limitations:"; break;
|
||||
@@ -810,11 +799,6 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
|
||||
store = choose_graphic(val, pics[btn - '0'], &me);
|
||||
if(store < 0) store = val;
|
||||
break;
|
||||
case '#':
|
||||
choose_string = false;
|
||||
store = val;
|
||||
giveError("Either you have not chosen a shop type yet, or the shop type you chose doesn't allow you to customize its items.",&me);
|
||||
break;
|
||||
default:
|
||||
choose_string = false;
|
||||
store = val;
|
||||
|
@@ -1014,7 +1014,6 @@ static bool save_talk_node(cDialog& me, std::string item_hit, std::stack<short>&
|
||||
for(int i = 0; i < 4; i++)
|
||||
talk_node.extras[i] = me["extra" + std::to_string(i + 1)].getTextAsNum();
|
||||
|
||||
int n;
|
||||
switch(talk_node.type) {
|
||||
case eTalkNode::DEP_ON_SDF: case eTalkNode::SET_SDF:
|
||||
if(cre(talk_node.extras[0],0,299,"First part of Stuff Done flag must be from 0 to 299.","",&me)) return false;
|
||||
@@ -1035,20 +1034,7 @@ static bool save_talk_node(cDialog& me, std::string item_hit, std::stack<short>&
|
||||
break;
|
||||
case eTalkNode::SHOP:
|
||||
if(cre(talk_node.extras[0],0,6,"Cost adjustment must be from 0 (cheapest) to 6 (most expensive).","",&me)) return false;
|
||||
if(cre(talk_node.extras[3],0,11,"Shop type must be from 0 to 11.", "", &me)) return false;
|
||||
switch(talk_node.extras[3]) {
|
||||
case int(eShopType::ITEMS): n = scenario.scen_items.size(); break;
|
||||
case int(eShopType::MAGE): case int(eShopType::PRIEST): n = 62; break;
|
||||
case int(eShopType::ALCHEMY): n = 20; break;
|
||||
case int(eShopType::SKILLS): n = 18; break;
|
||||
default: n = 0; break;
|
||||
}
|
||||
if(n > 0) {
|
||||
if(cre(talk_node.extras[1],0,n,"First item in shop must be from 0 to " + std::to_string(n), "", &me)) return false;
|
||||
if(cre(talk_node.extras[1],1,30,"Shops cannot have more than 30 items.", "", &me)) return false;
|
||||
int last = talk_node.extras[1] + talk_node.extras[2] - 1;
|
||||
if(cre(last,0,n,"Number of items in shop cannot be such that the last item does not exist.", "", &me)) return false;
|
||||
}
|
||||
if(cre(talk_node.extras[3],0,scenario.shops.size() - 1,"Which shop must refer to an existing shop.", "", &me)) return false;
|
||||
break;
|
||||
case eTalkNode::RECEIVE_QUEST:
|
||||
if(cre(talk_node.extras[0], 0, scenario.quests.size() - 1, "Quest must be an existing quest.", "", &me)) return false;
|
||||
@@ -1160,27 +1146,8 @@ static bool select_talk_node_value(cDialog& me, std::string item_hit, const std:
|
||||
const auto& talk_node = town->talking.talk_nodes[talk_edit_stack.top()];
|
||||
if(item_hit == "chooseB") {
|
||||
int i = me["extra2"].getTextAsNum();
|
||||
switch(talk_node.extras[3]) {
|
||||
case int(eShopType::MAGE):
|
||||
i = choose_text(STRT_MAGE,i,&me,"What is the first mage spell in the shop?");
|
||||
break;
|
||||
case int(eShopType::PRIEST):
|
||||
i = choose_text(STRT_PRIEST,i,&me,"What is the first priest spell in the shop?");
|
||||
break;
|
||||
case int(eShopType::ALCHEMY):
|
||||
i = choose_text(STRT_ALCHEMY,i,&me,"What is the first recipe in the shop?");
|
||||
break;
|
||||
case int(eShopType::ITEMS):
|
||||
i = choose_text(STRT_ITEM,i,&me,"What is the first item in the shop?");
|
||||
break;
|
||||
case int(eShopType::SKILLS):
|
||||
i = choose_text(STRT_SKILL,i,&me,"What is the first skill in the shop?");
|
||||
break;
|
||||
default:
|
||||
giveError("The shop type you've chosen doesn't support item customization!", &me);
|
||||
break;
|
||||
}
|
||||
me["extra1"].setTextToNum(i);
|
||||
i = choose_text(STRT_SHOP,i,&me,"Which shop?");
|
||||
me["extra2"].setTextToNum(i);
|
||||
} else if(item_hit == "chooseA") {
|
||||
int spec = me["extra1"].getTextAsNum();
|
||||
int mode = talk_node.type == eTalkNode::CALL_TOWN_SPEC ? 2 : 0;
|
||||
|
Reference in New Issue
Block a user