Preview button reflect node field changes immediately
This commit is contained in:
@@ -39,36 +39,6 @@ extern cScenario scenario;
|
||||
extern cOutdoors* current_terrain;
|
||||
extern cCustomGraphics spec_scen_g;
|
||||
|
||||
static bool preview_spec_enc_dlog(cDialog& me, std::string item_hit, cSpecial& special, short mode) {
|
||||
eSpecCtxType cur_type = static_cast<eSpecCtxType>(mode);
|
||||
|
||||
// Not pretty, but works:
|
||||
cUniverse univ;
|
||||
univ.scenario = scenario;
|
||||
univ.party.town_num = cur_town;
|
||||
univ.party.outdoor_corner = cur_out;
|
||||
univ.party.i_w_c = {0, 0};
|
||||
|
||||
switch(special.type){
|
||||
case eSpecType::ONCE_DIALOG:
|
||||
once_dialog(univ, special, cur_type, &me);
|
||||
break;
|
||||
default:{
|
||||
std::string str1;
|
||||
std::string str2;
|
||||
univ.get_strs(str1, str2, cur_type, special.m1, special.m2);
|
||||
|
||||
if(str1.empty() && str2.empty()) break;
|
||||
|
||||
short defaultBackground = cDialog::defaultBackground;
|
||||
cDialog::defaultBackground = cDialog::BG_DARK;
|
||||
cStrDlog(str1, str2, "", scenario.intro_pic, PIC_SCEN, &me).show();
|
||||
cDialog::defaultBackground = defaultBackground;
|
||||
}break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<pic_num_t> field_pics = {0,3,5,6,7,8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31,4};
|
||||
std::vector<pic_num_t> static_boom_pics = {0,1,2,3,4,5};
|
||||
std::vector<pic_num_t> boom_pics = {0,1,2,3,4,5,8,9,10,11,12,13};
|
||||
@@ -853,6 +823,39 @@ static void save_spec_enc(cDialog& me, node_stack_t& edit_stack) {
|
||||
the_node.jumpto = me["jump"].getTextAsNum();
|
||||
}
|
||||
|
||||
static bool preview_spec_enc_dlog(cDialog& me, std::string item_hit, node_stack_t& edit_stack, short mode) {
|
||||
save_spec_enc(me, edit_stack);
|
||||
cSpecial& special = edit_stack.top().node;
|
||||
|
||||
eSpecCtxType cur_type = static_cast<eSpecCtxType>(mode);
|
||||
|
||||
// Not pretty, but works:
|
||||
cUniverse univ;
|
||||
univ.scenario = scenario;
|
||||
univ.party.town_num = cur_town;
|
||||
univ.party.outdoor_corner = cur_out;
|
||||
univ.party.i_w_c = {0, 0};
|
||||
|
||||
switch(special.type){
|
||||
case eSpecType::ONCE_DIALOG:
|
||||
once_dialog(univ, special, cur_type, &me);
|
||||
break;
|
||||
default:{
|
||||
std::string str1;
|
||||
std::string str2;
|
||||
univ.get_strs(str1, str2, cur_type, special.m1, special.m2);
|
||||
|
||||
if(str1.empty() && str2.empty()) break;
|
||||
|
||||
short defaultBackground = cDialog::defaultBackground;
|
||||
cDialog::defaultBackground = cDialog::BG_DARK;
|
||||
cStrDlog(str1, str2, "", scenario.intro_pic, PIC_SCEN, &me).show();
|
||||
cDialog::defaultBackground = defaultBackground;
|
||||
}break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool commit_spec_enc(cDialog& me, std::string item_hit, node_stack_t& edit_stack) {
|
||||
if(item_hit != "unwind")
|
||||
save_spec_enc(me, edit_stack);
|
||||
@@ -1429,7 +1432,7 @@ bool edit_spec_enc(short which_node,short mode,cDialog* parent) {
|
||||
|
||||
special["back"].hide();
|
||||
edit_stack.push({which_node,mode,the_node});
|
||||
special["preview-dialog"].attachClickHandler(std::bind(preview_spec_enc_dlog, _1, _2, std::ref(edit_stack.top().node), mode));
|
||||
special["preview-dialog"].attachClickHandler(std::bind(preview_spec_enc_dlog, _1, _2, std::ref(edit_stack), mode));
|
||||
|
||||
put_spec_enc_in_dlog(special, edit_stack);
|
||||
|
||||
|
Reference in New Issue
Block a user