very messy support for recording 6-string dialog

This commit is contained in:
2025-08-06 15:29:01 -05:00
parent d17715f71f
commit 23106c6954
6 changed files with 89 additions and 15 deletions

View File

@@ -37,6 +37,9 @@ namespace {cBasicButtonType null_btn = boost::none;}
extern bbtt basic_buttons[71];
#endif
/// The signature of a record handler for cThreeChoice.
typedef std::function<void(cDialog&)> record_callback_t;
/// A choice dialog with several strings and up to three buttons.
/// This is the class used for dialogs generated by special nodes.
/// It generates the dialog dynamically from the given input.
@@ -48,6 +51,9 @@ class cThreeChoice : public cChoiceDlog {
void init_buttons(cBasicButtonType btn1, cBasicButtonType btn2, cBasicButtonType btn3);
void init_pict(pic_num_t pic);
const ePicType type;
record_callback_t rec_f;
bool hasRecord;
bool onRecord(std::string id);
public:
/// Create a dialog with just one button.
/// @param strings A list of the strings to place in the dialog.
@@ -70,12 +76,21 @@ public:
/// @param t The type of the icon.
/// @param parent Optionally, a parent dialog.
cThreeChoice(std::vector<std::string>& strings, std::array<short, 3>& buttons, pic_num_t pic, ePicType t, cDialog* parent = nullptr);
/// Set a record handler.
/// @param rec The handler.
/// @return This object, for method-call chaining.
/// @note Only one record handler can be set at a time. To remove it, set it to null.
/// @note The presence of the Record button is determined entirely by the presence of a record handler.
///
/// A record handler should take one parameter, which is a reference to the dialog.
/// (That's the cDialog, not the cThreeChoice.) It should return void.
cThreeChoice& setRecordHandler(record_callback_t rec);
/// @copydoc cChoiceDlog::show()
/// @note The unique key in this case is the label specified in the button specification.
std::string show();
};
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, cDialog* parent = nullptr);
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, cDialog* parent = nullptr);
#endif