preview two more one-time dialogs in editor

This commit is contained in:
2025-08-25 17:25:01 -05:00
parent 7f112d93f6
commit 9fa73862a0
4 changed files with 19 additions and 7 deletions

View File

@@ -224,14 +224,18 @@ short custom_choice_dialog(std::array<std::string, 6>& strs,short pic_num,ePicTy
return -1;
}
short once_dialog(cUniverse& univ, cSpecial& spec, eSpecCtxType cur_type, cDialog* parent) {
short once_dialog(cUniverse& univ, cSpecial& spec, eSpecCtxType cur_type, std::array<short, 3> buttons, cDialog* parent) {
std::array<std::string, 6> strs;
std::array<short, 3> buttons = {-1,-1,-1};
if(spec.m1 < 0)
return -1;
univ.get_strs(strs, cur_type, spec.m1);
return custom_choice_dialog(strs, spec.pic, ePicType(spec.pictype), buttons, true, spec.ex1c, spec.ex2c, &univ, parent);
}
short once_dialog(cUniverse& univ, cSpecial& spec, eSpecCtxType cur_type, cDialog* parent) {
std::array<short, 3> buttons = {-1,-1,-1};
if(spec.m3 > 0) {
// The first button defaults to OK if toggle is on
buttons[0] = 1;
@@ -249,7 +253,7 @@ short once_dialog(cUniverse& univ, cSpecial& spec, eSpecCtxType cur_type, cDialo
showError("Dialog box ended up with no buttons.");
return -1;
}
return custom_choice_dialog(strs, spec.pic, ePicType(spec.pictype), buttons, true, spec.ex1c, spec.ex2c, &univ, parent);
return once_dialog(univ, spec, cur_type, buttons, parent);
}
cThreeChoice& cThreeChoice::setRecordHandler(record_callback_t rec){

View File

@@ -91,6 +91,7 @@ public:
};
short custom_choice_dialog(std::array<std::string, 6>& strs,short pic_num,ePicType pic_type,std::array<short, 3>& buttons, bool anim_pict = false, short anim_loops = -1, int anim_fps = -1, cUniverse* univ = nullptr, cDialog* parent = nullptr);
short once_dialog(cUniverse& univ, cSpecial& spec, eSpecCtxType cur_type, std::array<short, 3> buttons, cDialog* parent = nullptr);
short once_dialog(cUniverse& univ, cSpecial& spec, eSpecCtxType cur_type, cDialog* parent = nullptr);
#endif

View File

@@ -40,22 +40,19 @@ namespace {
.ex2a(STRT_BUTTON)
.ex1b(eSpecPicker::NODE)
.ex2b(eSpecPicker::NODE);
// TODO implement preview
node_properties_t S_ITEM_DIALOG = node_builder_t(eSpecType::ONCE_GIVE_ITEM_DIALOG)
.sdf()
.msg1(eSpecPicker::MSG_SEQUENCE)
.msg3(STRT_SPEC_ITEM)
.pic()
.ex1a(STRT_ITEM)
.ex2b(eSpecPicker::NODE)
.no_preview();
.ex2b(eSpecPicker::NODE);
node_properties_t S_OUTENC = node_builder_t(eSpecType::ONCE_OUT_ENCOUNTER)
.sdf()
.msg();
node_properties_t S_TOWNENV = node_builder_t(eSpecType::ONCE_TOWN_ENCOUNTER)
.sdf()
.msg();
// TODO implement preview
node_properties_t S_TRAP = node_builder_t(eSpecType::ONCE_TRAP)
.sdf()
.msg()

View File

@@ -881,6 +881,16 @@ static bool preview_spec_enc_dlog(cDialog& me, std::string, cSpecial& special, s
story_dialog(univ, str1, special.m2, special.m3, cur_type, special.pic, ePicType(special.pictype), special.ex1c, special.ex2c);
cDialog::defaultBackground = defaultBackground;
}break;
case eSpecType::ONCE_GIVE_ITEM_DIALOG:{
std::array<short, 3> buttons = {9, 19, -1};
once_dialog(univ, special, cur_type, buttons, &me);
}break;
case eSpecType::ONCE_TRAP:{
std::array<short, 3> buttons = {3, 2, -1};
std::array<std::string,6> strs;
univ.get_strs(strs[0], strs[1], cur_type, special.m1, special.m2);
custom_choice_dialog(strs,special.pic,ePicType(special.pictype),buttons, true, special.ex1c, special.ex2c, &univ);
}break;
case eSpecType::ONCE_DIALOG:
once_dialog(univ, special, cur_type, &me);
break;